Skip to content

Commit 249fd7c

Browse files
authored
Update textClassifierHATT.py
1 parent 319cc17 commit 249fd7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

textClassifierHATT.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ def clean_str(string):
6969
for j, sent in enumerate(sentences):
7070
if j< MAX_SENTS:
7171
wordTokens = text_to_word_sequence(sent)
72-
for k, word in enumerate(wordTokens):
73-
if k<MAX_SENT_LENGTH:
72+
k=0
73+
for _, word in enumerate(wordTokens):
74+
if k<MAX_SENT_LENGTH and tokenizer.word_index[word]<MAX_NB_WORDS:
7475
data[i,j,k] = tokenizer.word_index[word]
76+
k=k+1
7577

7678
word_index = tokenizer.word_index
7779
print('Total %s unique tokens.' % len(word_index))

0 commit comments

Comments
 (0)