def test_recognizer(): """Test the recognizer end to end""" rec = AdeftRecognizer('ER', grounding_map) for text, result in [example1, example2, example3, example4, example5]: longform = rec.recognize(text) assert longform.pop() == result # Case where defining pattern appears at the start of the fragment assert not rec.recognize('(ER) stress')
def test_recognizer(): """Test the recognizer end to end""" rec = AdeftRecognizer('ER', grounding_map) for text, expected in [example1, example2, example3, example4, example5]: result = rec.recognize(text) assert result.pop()['grounding'] == expected # Case where defining pattern appears at the start of the fragment assert not rec.recognize('(ER) stress')
def test_exclude(): """Test that using excluded words works""" rec = AdeftRecognizer('ER', grounding_map, exclude=['emergency']) assert not rec.recognize(example3[0])