We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 319cc17 commit 249fd7cCopy full SHA for 249fd7c
textClassifierHATT.py
@@ -69,9 +69,11 @@ def clean_str(string):
69
for j, sent in enumerate(sentences):
70
if j< MAX_SENTS:
71
wordTokens = text_to_word_sequence(sent)
72
- for k, word in enumerate(wordTokens):
73
- if k<MAX_SENT_LENGTH:
+ k=0
+ for _, word in enumerate(wordTokens):
74
+ if k<MAX_SENT_LENGTH and tokenizer.word_index[word]<MAX_NB_WORDS:
75
data[i,j,k] = tokenizer.word_index[word]
76
+ k=k+1
77
78
word_index = tokenizer.word_index
79
print('Total %s unique tokens.' % len(word_index))
0 commit comments