Skip to content

Commit

Permalink
[#41] fix tokenize method to call right attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondng76 committed Dec 13, 2021
1 parent aa3e3d5 commit a519024
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sgnlp/models/sentic_asgcn/tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ def create_vocab(self, save_directory: str):
return vocab

def _tokenize(self, text, **kwargs):
text = text.lower()
if self.do_lower_case:
text = text.lower()
words = text.split()
unknownidx = 1
sequence = [
self.word2idx[w] if w in self.word2idx else unknownidx for w in words
]
sequence = [self.vocab[w] if w in self.vocab else unknownidx for w in words]
if len(sequence) == 0:
sequence = [0]
return sequence
Expand Down

0 comments on commit a519024

Please sign in to comment.