Beispiel #1
0
 def vocab(self, filename=None, lang=None):
     if filename is None:
         args = self.hyperparams.specific[lang] if lang else self.args
         filename = args.vocab
     if not filename:
         return None
     vocab = self._vocab.get(filename)
     if vocab:
         return vocab
     vocab = load_enum(filename)
     self._vocab[filename] = vocab
     return vocab
Beispiel #2
0
 def vocab(self, filename=None, lang=None):
     if filename is None:
         args = self.hyperparams.specific[lang] if lang else self.args
         filename = args.vocab
     if not filename:
         return None
     vocab = self._vocab.get(filename)
     if vocab:
         return vocab
     vocab = load_enum(filename)
     self._vocab[filename] = vocab
     return vocab