Skip to content

Commit 5d0cb62

Browse files
committed
Add back docstring
1 parent fbaecaa commit 5d0cb62

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

pythainlp/util/normalize.py

+21-3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,24 @@ def normalize(text: str) -> str:
251251

252252

253253
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+
"""
254272
if isinstance(sent, str):
255273
sent = word_tokenize(sent)
256274

@@ -300,7 +318,7 @@ def maiyamok(sent: Union[str, List[str]]) -> List[str]:
300318
repetition. This function preprocesses Thai text by replacing
301319
Maiyamok with a word being repeated.
302320
303-
:param Union[str, List[str]] sent: input sentence (list or str)
321+
:param Union[str, List[str]] sent: sentence (list or string)
304322
:return: list of words
305323
:rtype: List[str]
306324
@@ -309,8 +327,8 @@ def maiyamok(sent: Union[str, List[str]]) -> List[str]:
309327
310328
from pythainlp.util import expand_maiyamok
311329
312-
expand_maiyamok("เด็กๆกิน")
313-
# output: ['เด็ก', 'เด็ก', 'กิน']
330+
expand_maiyamok("คนๆนก")
331+
# output: ['คน', 'คน', 'นก']
314332
"""
315333
warn_deprecation(
316334
"pythainlp.util.maiyamok", "pythainlp.util.expand_maiyamok"

0 commit comments

Comments
 (0)