Exemplo n.º 1
0
def create_vocab_dictionaries():
    additional_special_tokens = (
        vocab_constants.MAX_SPECIAL_TOKENS -
        pytorch_translate_dictionary.Dictionary().nspecial)
    src_dict = dummy_dictionary(
        dummy_tokens=additional_special_tokens,
        additional_token_list=["a", "b", "c", "d", "e"],
    )
    tgt_dict = dummy_dictionary(
        dummy_tokens=additional_special_tokens,
        additional_token_list=["A", "B", "C", "D", "E"],
    )
    return src_dict, tgt_dict
Exemplo n.º 2
0
 def test_base(self):
     d = dictionary.Dictionary()
     self.assertEqual(len(d), d.nspecial)