Skip to content

Commit a0bf648

Browse files
committed
Update abbreviation.py
1 parent 4d19ae9 commit a0bf648

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pythainlp/util/abbreviation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
from typing import List, Tuple, Union
1919

2020

21-
def abbreviation_to_full_text(text: str) -> List[Tuple[str, Union[float, None]]]:
21+
def abbreviation_to_full_text(text: str, top_k: int=2) -> List[Tuple[str, Union[float, None]]]:
2222
"""
2323
This function convert Thai text (with abbreviation) to full text.
2424
2525
This function use KhamYo for handles abbreviations.
2626
See more `KhamYo <https://github.com/wannaphong/KhamYo>`_.
2727
2828
:param str text: Thai text
29-
:return: Thai full text that handles abbreviations as full text.
29+
:param int top_k: Top K
30+
:return: Thai full text that handles abbreviations as full text and cos scores (original text - modified text).
3031
:rtype: List[Tuple[str, Union[float, None]]]
3132
3233
:Example:
@@ -52,4 +53,4 @@ def abbreviation_to_full_text(text: str) -> List[Tuple[str, Union[float, None]]]
5253
pip install pythainlp[abbreviation].
5354
"""
5455
)
55-
return _replace(text)
56+
return _replace(text, top_k=top_k)

0 commit comments

Comments
 (0)