def test_markdown_entity_regex():
    r = MarkdownReader()
    md = "\n## intent:restaurant_search\n- i'm looking for a place to eat\n- i'm looking for a place in the [north](loc-direction) of town\n- show me [chines](cuisine:chinese) restaurants\n- show me [chines](22_ab-34*3.A:43er*+?df) restaurants\n    "
    result = r.reads(md)
    assert (len(result.training_examples) == 4)
    first = result.training_examples[0]
    assert (first.data == {'intent': 'restaurant_search'})
    assert (first.text == "i'm looking for a place to eat")
    second = result.training_examples[1]
    assert (second.data == {'intent': 'restaurant_search', 'entities': [{'start': 31, 'end': 36, 'value': 'north', 'entity': 'loc-direction'}]})
    assert (second.text == "i'm looking for a place in the north of town")
    third = result.training_examples[2]
    assert (third.data == {'intent': 'restaurant_search', 'entities': [{'start': 8, 'end': 14, 'value': 'chinese', 'entity': 'cuisine'}]})
    assert (third.text == 'show me chines restaurants')
    fourth = result.training_examples[3]
    assert (fourth.data == {'intent': 'restaurant_search', 'entities': [{'start': 8, 'end': 14, 'value': '43er*+?df', 'entity': '22_ab-34*3.A'}]})
    assert (fourth.text == 'show me chines restaurants')
def test_markdown_entity_regex():
    r = MarkdownReader()
    md = "\n## intent:restaurant_search\n- i'm looking for a place to eat\n- i'm looking for a place in the [north](loc-direction) of town\n- show me [chines](cuisine:chinese) restaurants\n- show me [chines](22_ab-34*3.A:43er*+?df) restaurants\n    "
    result = r.reads(md)
    assert (len(result.training_examples) == 4)
    first = result.training_examples[0]
    assert (first.data == {'intent': 'restaurant_search'})
    assert (first.text == "i'm looking for a place to eat")
    second = result.training_examples[1]
    assert (second.data == {'intent': 'restaurant_search', 'entities': [{'start': 31, 'end': 36, 'value': 'north', 'entity': 'loc-direction'}]})
    assert (second.text == "i'm looking for a place in the north of town")
    third = result.training_examples[2]
    assert (third.data == {'intent': 'restaurant_search', 'entities': [{'start': 8, 'end': 14, 'value': 'chinese', 'entity': 'cuisine'}]})
    assert (third.text == 'show me chines restaurants')
    fourth = result.training_examples[3]
    assert (fourth.data == {'intent': 'restaurant_search', 'entities': [{'start': 8, 'end': 14, 'value': '43er*+?df', 'entity': '22_ab-34*3.A'}]})
    assert (fourth.text == 'show me chines restaurants')