Skip to content

Commit

Permalink
Update other non-Thai characters in newmm
Browse files Browse the repository at this point in the history
  • Loading branch information
wannaphong committed Nov 1, 2023
1 parent fb3e7bb commit 02e9cb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pythainlp/tokenize/newmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
\d+([,\.]\d+)*| # numbers
[ \t]+| # spaces
\r?\n| # newlines
[^\u0E00-\u0E7F]+ # other non-Thai characters
[^\u0E00-\u0E7F \t]+ # other non-Thai characters
"""
)

Expand Down
9 changes: 9 additions & 0 deletions tests/test_tokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,15 @@ def test_newmm(self):
keep_whitespace=False,
)
)
self.assertEqual(
word_tokenize("(คนไม่เอา)", engine="newmm"), ['(', 'คน', 'ไม่', 'เอา', ')']
)
self.assertEqual(
word_tokenize("กม/ชม", engine="newmm"), ['กม', '/', 'ชม']
)
self.assertEqual(
word_tokenize("สีหน้า(รถ)", engine="newmm"), ['สีหน้า', '(', 'รถ', ')']
)

def test_newmm_longtext(self):
self.assertIsInstance(
Expand Down

0 comments on commit 02e9cb5

Please sign in to comment.