@@ -251,6 +251,24 @@ def normalize(text: str) -> str:
251
251
252
252
253
253
def expand_maiyamok (sent : Union [str , List [str ]]) -> List [str ]:
254
+ """
255
+ Expand Maiyamok.
256
+
257
+ Maiyamok (ๆ) (Unicode U+0E46) is a Thai character indicating word
258
+ repetition. This function preprocesses Thai text by replacing
259
+ Maiyamok with a word being repeated.
260
+
261
+ :param Union[str, List[str]] sent: sentence (list or string)
262
+ :return: list of words
263
+ :rtype: List[str]
264
+
265
+ :Example:
266
+ ::
267
+ from pythainlp.util import expand_maiyamok
268
+
269
+ expand_maiyamok("คนๆนก")
270
+ # output: ['คน', 'คน', 'นก']
271
+ """
254
272
if isinstance (sent , str ):
255
273
sent = word_tokenize (sent )
256
274
@@ -300,7 +318,7 @@ def maiyamok(sent: Union[str, List[str]]) -> List[str]:
300
318
repetition. This function preprocesses Thai text by replacing
301
319
Maiyamok with a word being repeated.
302
320
303
- :param Union[str, List[str]] sent: input sentence (list or str )
321
+ :param Union[str, List[str]] sent: sentence (list or string )
304
322
:return: list of words
305
323
:rtype: List[str]
306
324
@@ -309,8 +327,8 @@ def maiyamok(sent: Union[str, List[str]]) -> List[str]:
309
327
310
328
from pythainlp.util import expand_maiyamok
311
329
312
- expand_maiyamok("เด็กๆกิน ")
313
- # output: ['เด็ก ', 'เด็ก ', 'กิน ']
330
+ expand_maiyamok("คนๆนก ")
331
+ # output: ['คน ', 'คน ', 'นก ']
314
332
"""
315
333
warn_deprecation (
316
334
"pythainlp.util.maiyamok" , "pythainlp.util.expand_maiyamok"
0 commit comments