Skip to content

Commit f93cc5b

Browse files
authored
Merge pull request #1299 from PyThaiNLP/dev
Update dev to add-phupa-dataset branch
2 parents 0c3020c + 05b0ceb commit f93cc5b

70 files changed

Lines changed: 3615 additions & 2562 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ about: Propose a change or addition เสนอความสามารถ
55

66
## Detailed description
77

8-
<!--- Provide a detailed description of the change or addition you are proposing -->
8+
<!--- Provide a detailed description of the change or addition -->
99
<!--- รายละเอียดการเปลี่ยนแปลงหรือสิ่งเพิ่มเติมที่คุณกำลังเสนอ -->
1010

1111
## Context
@@ -17,8 +17,8 @@ about: Propose a change or addition เสนอความสามารถ
1717

1818
## Possible implementation
1919

20-
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
21-
<!--- ไม่จำเป็นต้องใส่ แต่คุณสามารถแนะนำได้ว่าการเปลี่ยนแปลงหรือเพิ่มเติมดังกล่าวน่าจะทำได้ด้วยวิธีไหน -->
20+
<!--- Suggest an idea for implementing the change or addition (Optional) -->
21+
<!--- แนะนำว่าจะเปลี่ยนแปลงหรือเพิ่มเติมได้ด้วยวิธีไหน (ไม่จำเป็นต้องใส่) -->
2222

2323
## Your environment
2424

.github/copilot-instructions.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
configuration. Communicate this to the users during code review.
1313
See <https://www.nltk.org/py-modindex.html>.
1414
- [ ] The type information analyzer at
15-
<https://github.com/PyThaiNLP/pythainlp/blob/dev/build_tools/analysis/type_hint_analyzer.py>
15+
<https://github.com/PyThaiNLP/pythainlp/blob/dev/build_tools/analysis/type-analyzer.py>
1616
can generate information about annotation completeness of
1717
variables, functions, methods, type aliases, decorators, and
1818
classes in the PyThaiNLP repo.
@@ -23,6 +23,13 @@
2323
please refer to Python tyep specification when in doubt.
2424
- [ ] Complete type annotations for function, method, class, variable, etc.
2525
Maintain near-100% type annotation coverage.
26+
- [ ] Add tests for new functionality or behavior.
27+
Keep the test coverage high.
28+
- [ ] Add test cases to capture edge cases.
29+
- [ ] Add test cases to cover code branches.
30+
- [ ] Major changes should be logged in the change log at
31+
<https://github.com/PyThaiNLP/pythainlp/blob/dev/CHANGELOG.md>.
32+
Provide issue number or PR number if available.
2633

2734
## Project contribution guidelines
2835

@@ -38,9 +45,9 @@
3845
- [ ] For significant changes, update the CHANGELOG.md file
3946
to document the changes.
4047
- [ ] Follow "Keep a Changelog" principles
41-
https://keepachangelog.com/en/1.0.0/
48+
<https://keepachangelog.com/en/1.0.0/>
4249
- [ ] Use semantic versioning for version numbers
43-
https://semver.org/
50+
<https://semver.org/>
4451
- [ ] If it is a breaking change, indicate it clearly in the changelog.
4552
- [ ] Provide migration instructions if necessary.
4653
- [ ] Do not leave trailing whitespaces in the code or documentation files,
@@ -98,10 +105,10 @@
98105
in names.
99106
- [ ] For URLs/IRIs, use lowercase letters and hyphens to separate words
100107
(e.g., `my-api-endpoint`) and follow W3C Cool URIs for the Semantic Web:
101-
https://www.w3.org/TR/cooluris/
108+
<https://www.w3.org/TR/cooluris/>
102109
- [ ] Consult Schema.org vocabularies when deciding about names.
103110
- [ ] Consult "Style Guidelines for Naming and Labeling Ontologies in the
104-
Multilingual Web" https://www.researchgate.net/publication/277224472
111+
Multilingual Web" <https://www.researchgate.net/publication/277224472>
105112

106113
## Tidy code and documentation
107114

@@ -121,7 +128,7 @@
121128
## File header
122129

123130
- [ ] When possible, put relevant SPDX File Tags at file header.
124-
See https://spdx.github.io/spdx-spec/v2.3/file-information/
131+
See <https://spdx.github.io/spdx-spec/v2.3/file-information/>
125132
- [ ] SPDX-FileContributor
126133
- [ ] SPDX-FileCopyrightText
127134
- [ ] Default SPDX-FileType for code is "SOURCE"
@@ -183,7 +190,7 @@
183190
## API
184191

185192
- [ ] The overall architecture, code, and API endpoints should follow the latest
186-
version of OpenAPI specification at https://spec.openapis.org/oas/
193+
version of OpenAPI specification at <https://spec.openapis.org/oas/>
187194
- [ ] API endpoints must use proper HTTP return codes.
188195
- [ ] Follow web best practices as recommended by OpenAPI, IETF, W3C, etc.
189196

@@ -208,7 +215,7 @@
208215
as much as possible.
209216
- [ ] Follow best practices and standard Python type hint patterns.
210217
- [ ] Use mypy as an assistant.
211-
- [ ] mypy is in "dev" optional dependency.
218+
- [ ] mypy is in "dev" optional dependency.
212219
- [ ] Sometimes mypy may report errors wrongly due to cache issues.
213220
Try to reset the cache if unexpected errors occured.
214221
- [ ] Use pyright, pyrefly, and pytype for second opinions.

.github/workflows/corpus.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# SPDX-FileCopyrightText: 2026 PyThaiNLP Project
2+
# SPDX-FileType: SOURCE
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Corpus test
6+
7+
on:
8+
push:
9+
branches:
10+
- dev
11+
paths:
12+
- ".github/workflows/corpus.yml"
13+
- "pythainlp/corpus/**"
14+
- "tests/corpus/**"
15+
pull_request:
16+
branches:
17+
- dev
18+
paths:
19+
- ".github/workflows/corpus.yml"
20+
- "pythainlp/corpus/**"
21+
- "tests/corpus/**"
22+
23+
# Avoid duplicate runs for the same source branch and repository
24+
concurrency:
25+
group: >-
26+
${{ github.workflow }}-${{
27+
github.event.pull_request.head.repo.full_name || github.repository
28+
}}-${{ github.head_ref || github.ref_name }}
29+
cancel-in-progress: true
30+
31+
jobs:
32+
corpus:
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v6
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v6
43+
with:
44+
python-version: "3.13"
45+
cache: "pip"
46+
47+
- name: Install dependencies
48+
run: |
49+
pip install --upgrade pip
50+
pip install .
51+
52+
- name: Test corpus catalog
53+
env:
54+
PYTHONIOENCODING: utf-8
55+
run: |
56+
python -m unittest discover -s tests/corpus -p "test_catalog*.py" -v
57+
58+
- name: Test built-in corpus files
59+
env:
60+
PYTHONIOENCODING: utf-8
61+
run: |
62+
python -m unittest discover -s tests/corpus -p "test_builtin_*.py" -v
63+
64+
- name: Test downloadable corpus files
65+
env:
66+
PYTHONIOENCODING: utf-8
67+
run: |
68+
python -m unittest discover -s tests/corpus -p "test_downloadable_*.py" -v

.github/workflows/markdownlint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-FileCopyrightText: 2026 PyThaiNLP contributors
2+
# SPDX-FileType: SOURCE
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Markdown lint
6+
7+
on:
8+
push:
9+
branches:
10+
- dev
11+
paths:
12+
- ".github/workflows/markdownlint.yml"
13+
- "**/*.md"
14+
pull_request:
15+
branches:
16+
- dev
17+
paths:
18+
- ".github/workflows/markdownlint.yml"
19+
- "**/*.md"
20+
21+
jobs:
22+
markdownlint:
23+
name: Run Markdown lint
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v6
28+
with:
29+
fetch-depth: 0
30+
31+
- uses: DavidAnson/markdownlint-cli2-action@v22
32+
with:
33+
globs: |
34+
**/*.md
35+
!License.md
36+
!LICENSE.md

.github/workflows/unittest.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project
22
# SPDX-License-Identifier: Apache-2.0
33

4+
# To reduce test time and save resources,
5+
# unit tests that download large corpus files will not be covered
6+
# in this workflow.
7+
# A separated corpus test workflow is in
8+
# https://github.com/PyThaiNLP/pythainlp/blob/dev/.github/workflows/corpus.yml
9+
# which will be triggered only if there is a change in a corpus.
10+
411
name: Unit test
512

613
on:
714
push:
15+
branches:
16+
- dev
817
paths:
918
- ".github/workflows/unittest.yml"
1019
- "bin/**"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,7 @@ logs/
129129
# Temp files
130130
*.tmp
131131
*.temp
132+
133+
# Type annotation analyzer
134+
build_tools/output/*.csv
135+
build_tools/output/*.json

.markdownlintrc renamed to .markdownlint.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"default": true,
33
"MD013": {
4-
"line_length": 150,
5-
"tables": false
4+
"line_length": 80,
5+
"tables": false,
6+
"code_blocks": false
67
},
78
"MD033": false,
89
"MD041": false,

CHANGELOG.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ 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.2.0...dev> (select tags to compare)
14+
<https://github.com/PyThaiNLP/pythainlp/compare/v5.2.0...dev>
15+
(select tags to compare)
1516

16-
# Version 5.2.0 -> dev
17+
## Version 5.2.0 -> dev
1718

1819
Minimum required version is now 3.9.
1920
Support for Python 3.7 and 3.8 has been removed.
@@ -34,6 +35,8 @@ See PR for prompt and details.
3435
- Make package zip-safe #1212
3536
- Ensure thread-safety for tokenizers #1213
3637
- Add Thai-NNER integration with top-level entity filtering #1221
38+
- Reorganize noauto test suite by dependency groups
39+
(torch, tensorflow, onnx, cython, network) #935
3740
- Improved documentation; code cleanup; more tests
3841

3942
## Version 5.1.2 -> 5.2.0
@@ -46,26 +49,31 @@ See PR for prompt and details.
4649
- Add budoux #1161
4750
- Remove conceptnet #1103
4851
- fix the connectivity of cli commands #1154
49-
- Fix Docker build failure, add docker compose file for convenience #1132
52+
- Fix Docker build failure, add docker compose file
53+
for convenience #1132
5054

5155
## Version 5.1.1 -> 5.1.2
5256

5357
- Update romanize docs and keep space #1110
5458

5559
## Version 5.1.0 -> 5.1.1
5660

57-
- PR Description: Refactor thai_consonants_all to Use set in syllable.py #1087
61+
- PR Description: Refactor thai_consonants_all to
62+
use set in syllable.py #1087
5863
- ThaiTransliterator: Select 1D CPU int64 tensor device #1089
5964

6065
## Version 5.0.5 -> 5.1.0
6166

6267
- Add Thai Discourse Treebank postag #910
6368
- Add Thai Universal Dependency Treebank postag #916
6469
- Add Thai G2P v2 Grapheme-to-Phoneme model #923
65-
- Add support for list of strings as input to sent_tokenize() #927
66-
- Add pythainlp.tools.safe_print to handle UnicodeEncodeError on console #969
70+
- Add support for list of strings as input
71+
to sent_tokenize() #927
72+
- Add pythainlp.tools.safe_print to handle UnicodeEncodeError
73+
on console #969
6774
- Fix collate() to consider tonemark in ordering #926
68-
- Fix nlpo3.load_dict() that never print error msg when not success #979
75+
- Fix nlpo3.load_dict() that never print error msg when
76+
not success #979
6977
- Add Thai Solar Date convert to Thai Lunar Date #998
7078
- Add Thai pangram text #1045
7179
- Remove clause_tokenize #1024
@@ -77,8 +85,8 @@ See PR for prompt and details.
7785

7886
## Version 5.0.3 -> 5.0.4
7987

80-
- Fix: pythainlp.util.maiyamok does not duplicate words when more than one
81-
Maiyamok is used #917
88+
- Fix: pythainlp.util.maiyamok does not duplicate words
89+
when more than one Maiyamok is used #917
8290

8391
## Version 5.0.2 -> 5.0.3
8492

@@ -87,8 +95,10 @@ See PR for prompt and details.
8795

8896
## Version 5.0.1 -> 5.0.2
8997

90-
- Fix: crfcut: Ensure splitting of sentences using terminal punctuation #905
98+
- Fix: crfcut: Ensure splitting of sentences using terminal
99+
punctuation #905
91100

92101
## Version 5.0.0 -> 5.0.1
93102

94-
- Fix: delay calling syllable_tokenize to avoid pycrfsuite ImportError #901
103+
- Fix: delay calling syllable_tokenize to avoid
104+
pycrfsuite ImportError #901

0 commit comments

Comments
 (0)