Esempio n. 1
0
 def test_as_training_data_produces_correct_numpy_arrays_with_character_tokenization(
         self):
     instance = IndexedSentenceInstance([[1, 2], [3, 1, 2]], [3, 4])
     instance.pad({'num_sentence_words': 3, 'num_word_characters': 4})
     inputs, label = instance.as_training_data()
     assert_array_equal(inputs, [[0, 0, 0, 0], [1, 2, 0, 0], [3, 1, 2, 0]])
     assert_array_equal(label, [[0], [3], [4]])
Esempio n. 2
0
 def test_as_training_data_produces_correct_numpy_arrays(self):
     instance = IndexedSentenceInstance([1, 2, 3, 4], [2, 3, 4, 5])
     inputs, label = instance.as_training_data()
     assert_array_equal(inputs, [1, 2, 3, 4])
     assert_array_equal(label, [[2], [3], [4], [5]])