diff --git a/CHANGELOG.md b/CHANGELOG.md index 330d57cde..fd2e19a27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,16 @@ and this project adheres to - Full release notes: - Commit history: +## [5.3.5] - 2026-07-30 + +### Fixed + +- Change loop limit from 20 to dec_maxlen #1464 +- fix: remove duplicate .replace mid-tone in _clean_ipa #1409 +- Fix: CodeQL ReDoS vulnerability in ULMFiT replace_url #1400 +- fix: remove unconditional overwrite that disables teacher forcing in Seq2Seq #1380 + + ## [5.3.4] - 2026-04-02 ### Fixed @@ -290,6 +300,7 @@ The minimum requirement is now Python 3.9. - See +[5.3.5]: https://github.com/PyThaiNLP/pythainlp/compare/v5.3.5...v5.3.5 [5.3.4]: https://github.com/PyThaiNLP/pythainlp/compare/v5.3.3...v5.3.4 [5.3.3]: https://github.com/PyThaiNLP/pythainlp/compare/v5.3.2...v5.3.3 [5.3.2]: https://github.com/PyThaiNLP/pythainlp/compare/v5.3.1...v5.3.2 diff --git a/CITATION.cff b/CITATION.cff index cd1b0b33e..7dbf5fe0e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -24,7 +24,7 @@ abstract: PyThaiNLP is a Thai natural language processing library for Python. It repository-code: "https://github.com/PyThaiNLP/pythainlp" type: software doi: 10.5281/zenodo.3519354 -version: 5.3.4 +version: 5.3.5 license-url: "https://spdx.org/licenses/Apache-2.0" keywords: - computational linguistics diff --git a/README.md b/README.md index 1235a3808..9160ddf24 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ pip install pythainlp | Version | Python version | Changes | Documentation | |:-------:|:--------------:|:-------:|:-------------:| -| [5.3.4](https://github.com/PyThaiNLP/pythainlp/releases) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/blob/dev/CHANGELOG.md#533---2026-03-26) | [pythainlp.org/docs](https://pythainlp.org/docs) | -| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/compare/v5.3.4...HEAD) | [pythainlp.org/dev-docs](https://pythainlp.org/dev-docs/) | +| [5.3.5](https://github.com/PyThaiNLP/pythainlp/releases) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/blob/dev/CHANGELOG.md) | [pythainlp.org/docs](https://pythainlp.org/docs) | +| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/compare/v5.3.5...HEAD) | [pythainlp.org/dev-docs](https://pythainlp.org/dev-docs/) | ## Features diff --git a/README_TH.md b/README_TH.md index f9fc5ff6b..1064becfd 100644 --- a/README_TH.md +++ b/README_TH.md @@ -29,8 +29,8 @@ pip install pythainlp | รุ่น | รุ่นของ Python | มีอะไรเปลี่ยน | เอกสาร | | :-: | :-: | :-: | :-: | -| [5.3.4](https://github.com/PyThaiNLP/pythainlp/releases) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/blob/dev/CHANGELOG.md#533---2026-03-26) | [pythainlp.org/docs](https://pythainlp.org/docs) | -| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/compare/v5.3.4...HEAD) | [pythainlp.org/dev-docs](https://pythainlp.org/dev-docs/) | +| [5.3.5](https://github.com/PyThaiNLP/pythainlp/releases) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/blob/dev/CHANGELOG.md) | [pythainlp.org/docs](https://pythainlp.org/docs) | +| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | 3.9+ | [Log](https://github.com/PyThaiNLP/pythainlp/compare/v5.3.5...HEAD) | [pythainlp.org/dev-docs](https://pythainlp.org/dev-docs/) | ## ความสามารถ diff --git a/codemeta.json b/codemeta.json index 919149e47..11347c03e 100644 --- a/codemeta.json +++ b/codemeta.json @@ -197,5 +197,5 @@ "https://pythainlp.org/Model-Cards/" ], "url": "https://pythainlp.org/", - "version": "5.3.4" + "version": "5.3.5" } diff --git a/pyproject.toml b/pyproject.toml index 308fda4ae..0f41604be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" [project] name = "pythainlp" -version = "5.3.4" +version = "5.3.5" description = "Thai Natural Language Processing library" readme = "README.md" requires-python = ">=3.9" @@ -312,7 +312,7 @@ include = [ ] [tool.bumpversion] -current_version = "5.3.4" +current_version = "5.3.5" commit = true tag = true parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)(\\-(?P[a-z]+)(?P\\d+))?" diff --git a/pythainlp/__init__.py b/pythainlp/__init__.py index 053401d49..c77c45671 100644 --- a/pythainlp/__init__.py +++ b/pythainlp/__init__.py @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project # SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 -__version__ = "5.3.4" +__version__ = "5.3.5" thai_consonants: str = ( "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars diff --git a/pythainlp/soundex/sound.py b/pythainlp/soundex/sound.py index 450968d1f..42010fd58 100644 --- a/pythainlp/soundex/sound.py +++ b/pythainlp/soundex/sound.py @@ -28,7 +28,6 @@ def _clean_ipa(ipa: str) -> str: .replace("˨˩", "") .replace("˦˥", "") .replace("˧", "") - .replace("˧", "") .replace(" .", ".") .replace(". ", ".") .strip() diff --git a/pythainlp/transliterate/thai2rom.py b/pythainlp/transliterate/thai2rom.py index 52ab6a28e..df9b8ebc6 100644 --- a/pythainlp/transliterate/thai2rom.py +++ b/pythainlp/transliterate/thai2rom.py @@ -426,8 +426,6 @@ def forward( else: decoder_input = topi.detach() - decoder_input = topi.detach() - if inference and decoder_input == end_token: return outputs[:di] diff --git a/pythainlp/transliterate/w2p.py b/pythainlp/transliterate/w2p.py index ccf0b018b..aa3a9ade0 100644 --- a/pythainlp/transliterate/w2p.py +++ b/pythainlp/transliterate/w2p.py @@ -294,7 +294,7 @@ def _predict(self, word: str) -> str: h = last_hidden preds: list[int] = [] - for _ in range(20): + for _ in range(hp.dec_maxlen): h = self._grucell( dec, h, diff --git a/pythainlp/ulmfit/preprocess.py b/pythainlp/ulmfit/preprocess.py index e5f80686b..85cbbc562 100644 --- a/pythainlp/ulmfit/preprocess.py +++ b/pythainlp/ulmfit/preprocess.py @@ -35,7 +35,7 @@ def replace_url(text: str) -> str: >>> replace_url("go to github.com") 'go to xxurl' """ - URL_PATTERN = r"""(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)/)(?:[^\s()<>{}\[\]]+|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])|(?:(?{}\[\]]|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])|(?:(?