Пример #1
0
def test_negation_bidirectional():
    miner = StatusMiner(rules=[])
    terms = [
        Term('I', 0, 1, 'C01', 1),
        Word('have', 2, 6),
        Negation('no', 7, 9, 'negn', 3),
        Term('beer', 10, 14, 'C02', 2),
    ]
    miner.postprocess(terms)
    assert terms[0].is_negated()
    assert terms[-1].is_negated()
Пример #2
0
def test_negation_end_scope_conj():
    miner = StatusMiner(rules=[])
    terms = [
        Term('I', 0, 1, 'C01', 1),
        Word('have', 2, 6),
        Negation('no', 7, 9, 'negn', 3),
        Term('beer', 10, 14, 'C02', 2),
        Negation('or', 15, 17, 'conj', 0),
        Term('wine', 18, 22, 'C02', 3),
    ]
    miner.postprocess(terms)
    assert terms[0].is_negated()
    assert terms[-3].is_negated()  # negates 'beer'
    assert not terms[-1].is_negated()  # 'or' blocks 'wine' from being negated