Skip to content

Commit 4b7644b

Browse files
authored
Merge pull request #1111 from PyThaiNLP/patch-1110
PyThaiNLP v5.1.2
2 parents ae8018c + a81fba1 commit 4b7644b

File tree

9 files changed

+25
-16
lines changed

9 files changed

+25
-16
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ Notable changes between versions.
1111
- For full release notes, see:
1212
<https://github.com/PyThaiNLP/pythainlp/releases>
1313
- For detailed commit changes, see:
14-
<https://github.com/PyThaiNLP/pythainlp/compare/v5.1.1...dev> (select tags to compare)
14+
<https://github.com/PyThaiNLP/pythainlp/compare/v5.1.2...dev> (select tags to compare)
1515

16-
## Version 5.1.1 -> Dev
16+
## Version 5.1.2 -> Dev
1717

1818
[WIP]
1919

20+
## Version 5.1.1 -> 5.1.2
21+
22+
- Update romanize docs and keep space #1110
23+
2024
## Version 5.1.0 -> 5.1.1
2125

2226
- PR Description: Refactor thai_consonants_all to Use set in syllable.py #1087

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ keywords:
4545
- "Thai language"
4646
- "Thai NLP"
4747
license: Apache-2.0
48-
version: 5.1.1
49-
date-released: "2025-03-31"
48+
version: 5.1.2
49+
date-released: "2025-05-09"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pip install pythainlp
3030
3131
| Version | Description | Status |
3232
|:------:|:--:|:------:|
33-
| [5.1.1](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/900) |
33+
| [5.1.2](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/900) |
3434
| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 5.2 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/1080) |
3535

3636
## Getting Started

README_TH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pip install pythainlp
2626
2727
| รุ่น | คำอธิบาย | สถานะ |
2828
|:------:|:--:|:------:|
29-
| [5.1.1](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/900) |
29+
| [5.1.2](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/900) |
3030
| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 5.2 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/1080) |
3131

3232
ติดตามพวกเราบน [PyThaiNLP Facebook page](https://www.facebook.com/pythainlp/) เพื่อรับข่าวสารเพิ่มเติม

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@type": "SoftwareSourceCode",
44
"name": "PyThaiNLP",
55
"description": "Thai Natural Language Processing in Python",
6-
"version": "5.1.1",
6+
"version": "5.1.2",
77
"author": [
88
{
99
"@type": "Person",

pythainlp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project
33
# SPDX-FileType: SOURCE
44
# SPDX-License-Identifier: Apache-2.0
5-
__version__ = "5.1.1"
5+
__version__ = "5.1.2"
66

77
thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars
88

pythainlp/transliterate/core.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ def romanize(
1414
fallback_engine: str = DEFAULT_ROMANIZE_ENGINE,
1515
) -> str:
1616
"""
17-
This function renders Thai words in the Latin alphabet or "romanization",
17+
This function renders Thai word in the Latin alphabet or "romanization",
1818
using the Royal Thai General System of Transcription (RTGS)
1919
[#rtgs_transcription]_. RTGS is the official system published
2020
by the Royal Institute of Thailand. (Thai: ถอดเสียงภาษาไทยเป็นอักษรละติน)
2121
22-
:param str text: Thai text to be romanized
22+
:param str text: A Thai word to be romanized. \
23+
The input should not include whitespace because \
24+
the function is support subwords by spliting whitespace.
2325
:param str engine: One of 'royin' (default), 'thai2rom', 'thai2rom_onnx, 'tltk', and 'lookup'. See more in options for engine section.
2426
:param str fallback_engine: If engine equals 'lookup', use `fallback_engine` for words that are not in the transliteration dict.
2527
No effect on other engines. Default to 'royin'.
2628
27-
:return: A string of Thai words rendered in the Latin alphabet.
29+
:return: A string of a Thai word rendered in the Latin alphabet.
2830
:rtype: str
2931
3032
:Options for engines:
@@ -53,6 +55,9 @@ def romanize(
5355
romanize("ภาพยนตร์", engine="royin")
5456
# output: 'phapn'
5557
58+
romanize("รส ดี", engine="royin") # subwords
59+
# output: 'rot di'
60+
5661
romanize("ภาพยนตร์", engine="thai2rom")
5762
# output: 'phapphayon'
5863
@@ -87,9 +92,9 @@ def select_romanize_engine(engine: str):
8792
else:
8893
rom_engine = select_romanize_engine(engine)
8994
trans_word = []
90-
for word in text.split(' '):
91-
trans_word.append(rom_engine(word))
92-
new_word = ''.join(trans_word)
95+
for subword in text.split(' '):
96+
trans_word.append(rom_engine(subword))
97+
new_word = ' '.join(trans_word)
9398
return new_word
9499

95100

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 5.1.1
2+
current_version = 5.1.2
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150

151151
setup(
152152
name="pythainlp",
153-
version="5.1.1",
153+
version="5.1.2",
154154
description="Thai Natural Language Processing library",
155155
long_description=LONG_DESC,
156156
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)