def test_index_finding(self): # This test uses a simulated recognize result for the following # text: "my phone number is:(425) 882-9090" match = "(425) 882-9090" # the start index of the match start = 19 tokens = ['my', 'phone', 'number', 'is:(425', ')', '882', '-', '9090'] tokens_indices = [0, 3, 9, 16, 23, 25, 28, 29] index = EntityRecognizer.find_index_of_match_token(match, start, tokens, tokens_indices) assert index == 3
def test_index_finding(): # This test uses a simulated recognize result for the following # text: "my phone number is:(425) 882-9090" match = "(425) 882-9090" # the start index of the match start = 19 tokens = ["my", "phone", "number", "is:(425", ")", "882", "-", "9090"] tokens_indices = [0, 3, 9, 16, 23, 25, 28, 29] index = EntityRecognizer.find_index_of_match_token(match, start, tokens, tokens_indices) assert index == 3