Skip to content

Commit

Permalink
Vythai (#706)
Browse files Browse the repository at this point in the history
Fixed Vietnamese nonbreaking space
  • Loading branch information
vythaihn committed May 28, 2021
1 parent e3a0c95 commit 1972122
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stanza/models/common/vocab.py
Expand Up @@ -47,6 +47,7 @@ def load_state_dict(cls, state_dict):
return new

def normalize_unit(self, unit):
unit = unit.replace(" ","\xa0")
if self.lower:
return unit.lower()
return unit
Expand Down Expand Up @@ -79,7 +80,7 @@ def __getitem__(self, key):
raise TypeError("Vocab key must be one of str, list, or int")

def __contains__(self, key):
return key in self._unit2id
return self.normalize_unit(key) in self._unit2id

@property
def size(self):
Expand Down

0 comments on commit 1972122

Please sign in to comment.