diff --git a/fairseq/data/dictionary.py b/fairseq/data/dictionary.py index 7ad590a19b..3b8b741c4d 100644 --- a/fairseq/data/dictionary.py +++ b/fairseq/data/dictionary.py @@ -126,7 +126,7 @@ def unk_string(self, escape=False): def add_symbol(self, word, n=1, overwrite=False): """Adds a word to the dictionary""" - if word in self.indices and not overwrite: + if word in self.indices and overwrite: idx = self.indices[word] self.count[idx] = self.count[idx] + n return idx