예제 #1
0
def test_add_trigram():
    phrase = 'test phrase'
    tri = {}
    word1 = 'numb1'
    word2 = 'numb2'
    test_phrase = trigrams.phrase_to_tuple(phrase)
    trigrams.add_trigrams(test_phrase, word1, tri)
    assert(tri == {('test', 'phrase'): ['numb1']})
    trigrams.add_trigrams(test_phrase, word2, tri)
    assert(tri == {('test', 'phrase'): ['numb1', 'numb2']})
예제 #2
0
def test_tuple():
    test_phrase = "test phrase"
    assert(trigrams.phrase_to_tuple(test_phrase) == ('test', 'phrase'))