예제 #1
0
 def test_pad_word_sequence_handles_words_and_characters(self):
     instance = IndexedTrueFalseInstance([[1, 2], [3, 1, 2]], True)
     padded = instance.pad_word_sequence(instance.word_indices, {
         'word_sequence_length': 3,
         'word_character_length': 4
     })
     assert padded == [[0, 0, 0, 0], [1, 2, 0, 0], [3, 1, 2, 0]]
예제 #2
0
 def test_pad_word_sequence_handles_words_and_characters_greater(self):
     instance = IndexedTrueFalseInstance([[1, 2], [3, 1, 2]], True)
     padded = instance.pad_word_sequence(instance.word_indices, {
         'num_sentence_words': 5,
         'num_word_characters': 4
     })
     assert padded == [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
                       [1, 2, 0, 0], [3, 1, 2, 0]]