utils(string): support email addresses in end of sentence matching

This commit is contained in:
Aleix Conchillo Flaqué
2025-02-26 17:23:06 -08:00
parent 2e0c6c2bd1
commit 1dbad2326a
3 changed files with 25 additions and 1 deletions

View File

@@ -18,6 +18,9 @@ class TestUtilsString(unittest.IsolatedAsyncioTestCase):
assert match_endofsentence("This is a sentence...") == 21
assert match_endofsentence("This is a sentence . . .") == 24
assert match_endofsentence("This is a sentence. ..") == 22
assert match_endofsentence("This is for Mr. and Mrs. Jones.") == 31
assert match_endofsentence("U.S.A and U.S.A..") == 17
assert match_endofsentence("My emails are foo@pipecat.ai and bar@pipecat.ai.") == 48
assert not match_endofsentence("This is not a sentence")
assert not match_endofsentence("This is not a sentence,")
assert not match_endofsentence("This is not a sentence, ")
@@ -28,6 +31,7 @@ class TestUtilsString(unittest.IsolatedAsyncioTestCase):
assert not match_endofsentence("Heute ist Dienstag, der 3.") # 3. Juli 2024
assert not match_endofsentence("America, or the U.") # U.S.A.
assert not match_endofsentence("It still early, it's 3:00 a.") # 3:00 a.m.
assert not match_endofsentence("My emails are foo@pipecat.ai and bar@pipecat.ai")
async def test_endofsentence_zh(self):
chinese_sentences = [