Beispiel #1
0
def test_imperfect_match_at_the_start_slot_extraction():
    match = match_pattern(pipeline('эй бот, это очень длинная фраза'),
                          pipeline('это {slot}'))
    assert tokens_to_text(match.slots['slot']) == 'очень длинная фраза'
Beispiel #2
0
def test_imperfect_match_at_the_end_slot_extraction():
    match = match_pattern(pipeline('это очень длинная фраза! понятненько?!'),
                          pipeline('это {slot}!'))
    assert tokens_to_text(match.slots['slot']) == 'очень длинная фраза'
Beispiel #3
0
def test_slot_multi_token_match_start():
    match = match_pattern(pipeline('очень длинная фраза'),
                          pipeline('{slot} фраза'))
    assert tokens_to_text(match.slots['slot']) == 'очень длинная'
Beispiel #4
0
def test_slot_multi_token_match_end():
    match = match_pattern(pipeline('очень длинная и сложная фраза'),
                          pipeline('очень {slot}'))
    assert tokens_to_text(match.slots['slot']) == 'длинная и сложная фраза'
Beispiel #5
0
def test_slot_int_the_middle():
    match = match_pattern(pipeline('очень длинная фраза'),
                          pipeline('очень {slot} фраза'))
    assert tokens_to_text(match.slots['slot']) == 'длинная'
Beispiel #6
0
def test_slot_at_the_end():
    match = match_pattern(pipeline('длинная фраза'),
                          pipeline('длинная {slot}'))
    assert tokens_to_text(match.slots['slot']) == 'фраза'
Beispiel #7
0
def test_slot_match_whole():
    match = match_pattern(pipeline('длинная фраза'), pipeline('{slot}'))
    assert tokens_to_text(match.slots['slot']) == 'длинная фраза'
Beispiel #8
0
def test_mismatch():
    match = match_pattern(pipeline('привет'), pipeline('банан'))
    assert match.score < 0.5
Beispiel #9
0
def test_no_slots():
    match = match_pattern(pipeline('привет'), pipeline('привет'))
    assert match.score > 0