示例#1
0
 def test_words2indices(self):
     v = Vocab('unk')
     words = ['i', 'like', 'pie']
     v.update(words)
     v = v.freeze()
     assert v.words2indices(words) == [1, 2, 3]
     assert v.words2indices(['i', 'said']) == [1, 0]
示例#2
0
 def test_words2indices(self):
     v = Vocab('unk')
     words = ['i', 'like', 'pie']
     v.update(words)
     v = v.freeze()
     assert v.words2indices(words) == [1, 2, 3]
     assert v.words2indices(['i', 'said']) == [1, 0]