Exemple #1
0
 def test_disp_sentences_from_indices(
     self, instances, tmpdir, include_special_vocab
 ):
     instance_dict = instances
     single_instance = instance_dict["single_instance"]
     MAX_NUM_WORDS = None
     vocab = Vocab(
         instances=single_instance,
         max_num_tokens=MAX_NUM_WORDS,
         include_special_vocab=include_special_vocab,
     )
     vocab.build_vocab()
     sent = vocab.get_disp_sentence_from_indices([0, 1, 2])
     assert type(sent) is str
Exemple #2
0
 def test_disp_sentences_from_indices(self, instances, tmpdir):
     instance_dict = instances
     single_instance = instance_dict["single_instance"]
     MAX_NUM_WORDS = 100
     vocab_file = tmpdir.mkdir("tempdir").join("vocab.json")
     vocab = Vocab(
         instances=single_instance,
         max_num_tokens=MAX_NUM_WORDS,
         embedding_type=None,
         embedding_dimension=300,
         store_location=vocab_file,
     )
     vocab.build_vocab()
     sent = vocab.get_disp_sentence_from_indices([0, 1, 2, 3])
     assert type(sent) is str