paulhindemith commited on
Commit
624864d
1 Parent(s): d1887dd

commit files to HF hub

Browse files
Files changed (1) hide show
  1. fasttext_jp_tokenizer.py +4 -1
fasttext_jp_tokenizer.py CHANGED
@@ -100,7 +100,10 @@ class FastTextJpTokenizer(MeCabTokenizer):
100
  Returns:
101
  int: ID
102
  """
103
- return self.stoi[token]
 
 
 
104
 
105
  def _convert_id_to_token(self, index: int) -> str:
106
  """IDから単語
 
100
  Returns:
101
  int: ID
102
  """
103
+ id = self.stoi.get(token)
104
+ if id is not None:
105
+ return id
106
+ return self.stoi[self.unk_token]
107
 
108
  def _convert_id_to_token(self, index: int) -> str:
109
  """IDから単語