diff --git a/CITATION.cff b/CITATION.cff index 93201113d..a5e966080 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,4 +1,4 @@ -cff-version: 1.1.0 +cff-version: "1.2.0" message: "If you use this software, please cite it as below." authors: - family-names: "Phatthiyaphaibun" @@ -20,5 +20,6 @@ authors: given-names: "Pattarawat" orcid: "https://orcid.org/0000-0000-0000-0000" title: "PyThaiNLP: Thai Natural Language Processing in Python" -version: v5.0.3 -date-released: 2024-05-12 +version: v5.0.4 +license: Apache-2.0 +date-released: 2024-06-02 \ No newline at end of file diff --git a/README.md b/README.md index fb1c9100f..5f20220bc 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ PyThaiNLP เป็นไลบารีภาษาไพทอนสำหร | Version | Description | Status | |:------:|:--:|:------:| -| [5.0.3](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/788) | +| [5.0.4](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/788) | | [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 5.1 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/900) | ## Getting Started diff --git a/README_TH.md b/README_TH.md index 806f85a36..c7b6d0a25 100644 --- a/README_TH.md +++ b/README_TH.md @@ -20,7 +20,7 @@ PyThaiNLP เป็นไลบารีภาษาไพทอนสำหร | รุ่น | คำอธิบาย | สถานะ | |:------:|:--:|:------:| -| [5.0.3](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/788) | +| [5.0.4](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/788) | | [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 5.1 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/900) | ติดตามพวกเราบน [PyThaiNLP Facebook page](https://www.facebook.com/pythainlp/) เพื่อรับข่าวสารเพิ่มเติม diff --git a/pythainlp/__init__.py b/pythainlp/__init__.py index 4cf4887c5..486399802 100644 --- a/pythainlp/__init__.py +++ b/pythainlp/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # SPDX-FileCopyrightText: 2016-2024 PyThaiNLP Project # SPDX-License-Identifier: Apache-2.0 -__version__ = "5.0.3" +__version__ = "5.0.4" thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars diff --git a/pythainlp/tag/thainer.py b/pythainlp/tag/thainer.py index 97e1f15bf..7e7ed2571 100644 --- a/pythainlp/tag/thainer.py +++ b/pythainlp/tag/thainer.py @@ -83,7 +83,7 @@ class ThaiNameTagger: :Example: :: - from pythainlp.tag.named_entity import ThaiNameTagger + from pythainlp.tag.thainer import ThaiNameTagger thainer14 = ThaiNameTagger(version="1.4") thainer14.get_ner("วันที่ 15 ก.ย. 61 ทดสอบระบบเวลา 14:49 น.") @@ -133,7 +133,7 @@ def get_ner( :Example: - >>> from pythainlp.tag.named_entity import ThaiNameTagger + >>> from pythainlp.tag.thainer import ThaiNameTagger >>> >>> ner = ThaiNameTagger() >>> ner.get_ner("วันที่ 15 ก.ย. 61 ทดสอบระบบเวลา 14:49 น.") diff --git a/pythainlp/util/normalize.py b/pythainlp/util/normalize.py index 3276e6e8d..bee233afe 100644 --- a/pythainlp/util/normalize.py +++ b/pythainlp/util/normalize.py @@ -283,9 +283,12 @@ def maiyamok(sent: Union[str, List[str]]) -> List[str]: if "ๆ" == text: text = _list_word[i - 1] elif "ๆ" in text: - text = text.replace("ๆ", "") - _list_word.append(text) + count = text.count("ๆ") + text = _list_word[i - 1] + for _ in range(count): + _list_word.append(text) i += 1 + continue _list_word.append(text) i += 1 return _list_word diff --git a/setup.cfg b/setup.cfg index 49f95284d..d4b3f16d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 5.0.3 +current_version = 5.0.4 commit = True tag = True parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))? diff --git a/setup.py b/setup.py index 77348f962..949f1c20c 100644 --- a/setup.py +++ b/setup.py @@ -161,7 +161,7 @@ setup( name="pythainlp", - version="5.0.3", + version="5.0.4", description="Thai Natural Language Processing library", long_description=readme, long_description_content_type="text/markdown", diff --git a/tests/test_util.py b/tests/test_util.py index a19651a60..3fdcfee04 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -531,6 +531,10 @@ def test_normalize(self): maiyamok("เด็กๆชอบไปโรงเรียน"), ["เด็ก", "เด็ก", "ชอบ", "ไป", "โรงเรียน"], ) + self.assertEqual( + maiyamok("เด็กๆๆชอบไปโรงเรียน"), + ['เด็ก', 'เด็ก', 'เด็ก', 'ชอบ', 'ไป', 'โรงเรียน'], + ) # 914 self.assertEqual( maiyamok( ["ทำไม", "คน", "ดี", " ", "ๆ", "ๆ", " ", "ถึง", "ทำ", "ไม่ได้"]