-
-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathpyproject.toml
More file actions
509 lines (430 loc) · 11.9 KB
/
pyproject.toml
File metadata and controls
509 lines (430 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: Apache-2.0
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "pythainlp"
version = "5.3.4"
description = "Thai Natural Language Processing library"
readme = "README.md"
requires-python = ">=3.9"
license = "Apache-2.0"
authors = [
{ name = "Wannaphong Phatthiyaphaibun", email = "wannaphong@pythainlp.org" },
{ name = "Korakot Chaovavanich" },
{ name = "Charin Polpanumas" },
{ name = "Arthit Suriyawongkul", email = "suriyawa@tcd.ie" },
{ name = "Lalita Lowphansirikul" },
{ name = "Pattarawat Chormai" },
{ name = "Peerat Limkonchotiwat" },
{ name = "Thanathip Suntorntip" },
{ name = "Can Udomcharoenchaikit" },
]
maintainers = [
{ name = "Wannaphong Phatthiyaphaibun", email = "wannaphong@pythainlp.org" },
{ name = "Arthit Suriyawongkul", email = "suriyawa@tcd.ie" },
]
keywords = [
"pythainlp",
"NLP",
"natural language processing",
"tokenization",
"text processing",
"linguistics",
"localization",
"computational linguistics",
"ThaiNLP",
"Thai NLP",
"Thai language",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Intended Audience :: Developers",
"Natural Language :: Thai",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Localization",
"Topic :: Text Processing",
"Topic :: Text Processing :: General",
"Topic :: Text Processing :: Linguistic",
]
# Core dependencies
dependencies = [
"importlib_resources; python_version < '3.11'",
"tzdata; sys_platform == 'win32'",
]
[project.optional-dependencies]
## 1) Development ########################################
dev = [
"black>=25.11.0",
"build>=1.0.0",
"bump-my-version>=1.2.6",
"coverage>=7.10.7",
"flake8>=7.0.0",
"flake8-type-checking>=3.2.0",
"mypy>=1.19.1",
"pylint>=4.0.0",
"ruff>=0.14.14",
"tox>=4.30.3",
]
docs = [
"Sphinx>=6.2",
"sphinx-copybutton>=0.5.2",
"sphinx-rtd-theme>=3.1.0",
]
## 2) Feature sets #######################################
abbreviation = ["khamyo>=0.2.0"]
attacut = ["attacut>=1.0.6"]
attaparse = ["attaparse>=1.0.0"]
benchmarks = ["numpy>=1.22", "pandas>=0.24", "PyYAML>=5.4.1"]
budoux = ["budoux>=0.7.0"]
coreference_resolution = ["fastcoref>=2.1.5", "spacy>=3.0"]
dependency_parsing = [
"attaparse>=1.0.0",
"spacy_thai>=0.7.1",
"transformers>=4.22.1",
"ufal.chu-liu-edmonds>=1.0.2",
]
el = ["multiel>=0.5"]
esupar = ["esupar>=1.3.8", "numpy>=1.22", "transformers>=4.22.1"]
generate = ["fastai<2.0"]
icu = ["pyicu>=2.3"]
ipa = ["epitran>=1.1"]
ml = ["numpy>=1.22", "torch>=1.0.0"]
mt5 = ["sentencepiece>=0.1.91", "transformers>=4.22.1"]
nlpo3 = ["nlpo3>=1.4.0"]
onnx = ["numpy>=1.22", "onnxruntime>=1.10.0", "sentencepiece>=0.1.91"]
oskut = ["oskut>=1.3"]
qwen3 = ["torch>=1.9.0", "transformers>=4.22.1"]
sefr_cut = ["sefr_cut>=1.1"]
spacy_thai = ["spacy_thai>=0.7.1"]
spell = ["phunspell>=0.1.6", "symspellpy>=6.7.6"]
ssg = ["ssg>=0.0.8"]
textaugment = ["bpemb>=0.3.2", "gensim>=4.0.0"]
thai_nner = ["thai_nner>=0.3"]
thai2fit = ["emoji>=0.5.1", "gensim>=4.0.0", "numpy>=1.22"]
thai2rom = ["numpy>=1.22", "torch>=1.0.0"]
translate = [
'fairseq>=0.10.0,<0.13;python_version<"3.11"',
'fairseq-fixed==0.12.3.1,<0.13;python_version>="3.11"',
"sacremoses>=0.0.41",
"sentencepiece>=0.1.91",
"torch>=1.0.0",
"transformers>=4.22.1",
"word2word>=1.0.0",
]
transformers_ud = ["transformers>=4.22.1", "ufal.chu-liu-edmonds>=1.0.2"]
wangchanberta = ["sentencepiece>=0.1.91", "transformers>=4.22.1"]
wangchanglm = ["pandas>=0.24", "sentencepiece>=0.1.91", "transformers>=4.22.1"]
word_approximation = ["panphon>=0.20.0"]
wordnet = ["nltk>=3.3"]
wsd = ["sentence-transformers>=2.2.2"]
wtp = ["transformers>=4.22.1", "wtpsplit>=1.0.1"]
wunsen = ["wunsen>=0.0.3"]
## 3) Testing ############################################
# Below are dependency groups for each defined test suites
# Compact dependencies - for tests.compact modules
# Safe small set of optional dependencies
# for common tasks like tokenization and tagging.
compact = [
"nlpo3>=1.4.0",
"numpy>=1.26.0",
"pyicu>=2.3",
"python-crfsuite>=0.9.7",
"PyYAML>=5.4.1",
]
# Extra dependencies - for tests.extra modules
extra = [
"bpemb>=0.3.2",
"budoux>=0.7.0",
"gensim>=4.0.0",
"nltk>=3.3",
"pandas>=0.24",
"ssg>=0.0.8",
"symspellpy>=6.7.6",
"tltk>=1.10",
]
# Noauto test dependencies - for tests.noauto_* modules
# These are further grouped by dependency framework to avoid conflicts
# PyTorch-based dependencies - for tests.noauto_torch
noauto-torch = [
"attacut>=1.0.6",
"numpy>=1.26.0",
"sentencepiece>=0.1.91",
"thai-nner>=0.3",
"tltk>=1.10",
"torch>=1.13.1",
"transformers>=4.22.1",
"wtpsplit>=1.0.1",
]
# TensorFlow-based dependencies - for tests.noauto_tensorflow
noauto-tensorflow = [
"deepcut>=0.7.0",
"numpy>=1.26.0",
]
# ONNX Runtime-based dependencies - for tests.noauto_onnx
noauto-onnx = [
"numpy>=1.26.0",
"onnxruntime>=1.10.0",
"oskut>=1.3",
"sefr_cut>=1.1",
]
# Cython-based dependencies - for tests.noauto_cython
noauto-cython = [
"phunspell>=0.1.6",
]
# Network-dependent tests - for tests.noauto_network
# These tests require network access but minimal dependencies
noauto-network = [
"huggingface-hub>=0.16.0",
]
# Full dependencies - pinned where available
full = [
"attacut==1.0.6",
"attaparse==1.0.0",
"bpemb>=0.3.6,<0.4",
"budoux==0.7.0",
"deepcut==0.7.0.0",
"emoji>=0.6.0,<1",
"epitran==1.26.0",
"esupar>=1.3.9,<2",
'fairseq>=0.10.0,<0.13;python_version<"3.11"',
'fairseq-fixed==0.12.3.1,<0.13;python_version>="3.11"',
"fastai>=1.0.61,<2",
"fastcoref==2.1.6",
"gensim>=4.3.3,<5",
"khamyo>=0.3.0",
"khanaa>=0.1.1,<1",
"nlpo3>=1.4.0",
"nltk>=3.6.6,<4",
"numpy>=1.26.0,<3",
"onnxruntime>=1.10.0",
"oskut>=1.3",
"pandas>=2.2.0,<3",
"panphon==0.22.2",
"phunspell==0.1.6",
"pyicu>=2.15.2,<3",
"python-crfsuite==0.9.12",
"PyYAML>=5.4.1,<6.0.2",
"sacremoses==0.1.1",
"sentence-transformers>=2.7.0,<3",
"sentencepiece==0.2.1",
"spacy==3.8.7,<4",
"spacy_thai==0.7.8",
"ssg==0.0.8",
"sefr_cut>=1.1",
"symspellpy==6.9.0",
"thai-nner==0.3",
"tltk>=1.10,<2",
"torch>=1.13.1,<3",
"transformers==4.57.6",
"ufal.chu-liu-edmonds==1.0.3",
"word2word>=1.0.0,<2",
"wtpsplit==1.3.0",
"wunsen==0.0.3",
]
[project.urls]
homepage = "https://pythainlp.org/"
source = "https://github.com/PyThaiNLP/pythainlp.git"
download = "https://pypi.org/project/pythainlp/#files"
changelog = "https://github.com/PyThaiNLP/pythainlp/blob/dev/CHANGELOG.md"
releasenotes = "https://github.com/PyThaiNLP/pythainlp/releases"
documentation = "https://pythainlp.org/docs/"
issues = "https://github.com/PyThaiNLP/pythainlp/issues"
"Tutorials" = "https://pythainlp.org/tutorials/"
[project.scripts]
thainlp = "pythainlp.__main__:main"
[tool.hatch.build.targets.wheel]
packages = ["pythainlp"]
[tool.hatch.build.targets.sdist]
include = [
"pythainlp/",
"tests/",
"LICENSE",
"README.md",
]
[tool.bumpversion]
current_version = "5.3.4"
commit = true
tag = true
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\-(?P<release>[a-z]+)(?P<build>\\d+))?"
serialize = [
"{major}.{minor}.{patch}-{release}{build}",
"{major}.{minor}.{patch}",
]
[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'
[[tool.bumpversion.files]]
filename = "pythainlp/__init__.py"
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'
[[tool.bumpversion.files]]
filename = "CITATION.cff"
search = 'version: {current_version}'
replace = 'version: {new_version}'
[[tool.bumpversion.files]]
filename = "CITATION.cff"
regex = true
search = 'date-released: \d{{4}}-\d{{2}}-\d{{2}}'
replace = 'date-released: {now:%Y-%m-%d}'
[[tool.bumpversion.files]]
filename = "codemeta.json"
search = '"version": "{current_version}"'
replace = '"version": "{new_version}"'
[[tool.bumpversion.files]]
filename = "codemeta.json"
regex = true
search = '"dateModified": "\d{{4}}-\d{{2}}-\d{{2}}"'
replace = '"dateModified": "{now:%Y-%m-%d}"'
[tool.bumpversion.parts.release]
optional_value = "prod"
first_value = "dev"
values = ["dev", "beta", "prod"]
[tool.coverage.run]
source = ["pythainlp"]
[tool.ruff]
indent-width = 4
line-length = 79
target-version = "py39"
[tool.ruff.format]
docstring-code-format = true
indent-style = "space"
line-ending = "auto"
quote-style = "double"
skip-magic-trailing-comma = false
[tool.ruff.lint]
# Flag errors (`C901`) whenever the complexity level exceeds 5. Default is 10.
# We should aim to gradually reduce this to 10.
mccabe.max-complexity = 38
select = [
"E",
"F",
"I",
"W",
"S",
"B028",
"C901",
"F401",
"F811",
"F841",
"W291",
"W293",
]
# Some rules are ignored for now; we can consider enabling them in the future.
# S101 is use of assert statement, should be an easy fix.
extend-ignore = ["E402", "E501", "E722", "S101", "S202", "S301", "S310"]
[tool.tox]
env_list = ["py39", "py310", "py311", "py312", "py313", "py314", "pypy310", "pypy311", "ruff"]
skip_missing_interpreters = true
[tool.tox.env_run_base]
commands = [["python", "-m", "unittest", "tests.core", "tests.compact"]]
extras = ["compact"]
[tool.tox.env.pypy310]
basepython = "pypy3.10"
[tool.tox.env.pypy311]
basepython = "pypy3.11"
[tool.tox.env.ruff]
basepython = "python"
commands = [["ruff", "check", "pythainlp"], ["ruff", "format", "--check", "pythainlp"]]
deps = "ruff"
skip_install = true
[tool.mypy]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
pretty = true
python_version = "3.9"
show_column_numbers = true
show_error_code_links = true
show_error_context = true
strict = true
strict_bytes = true
strict_equality = true
strict_equality_for_none = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
module = ["tests.*"]
disallow_untyped_defs = false
# Ignore missing imports for optional dependencies
[[tool.mypy.overrides]]
module = [
"attacut.*",
"attaparse.*",
"bpemb.*",
"budoux.*",
"deepcut.*",
"emoji.*",
"epitran.*",
"esupar.*",
"fairseq.*",
"fastai.*",
"fastcoref.*",
"gensim.*",
"huggingface_hub.*",
"icu.*",
"importlib_resources",
"importlib_resources.*",
"khamyo.*",
"khanaa.*",
"multiel.*",
"nltk.*",
"nlpo3.*",
"numpy.*",
"onnxruntime.*",
"oskut.*",
"pandas.*",
"panphon.*",
"phunspell.*",
"pycrfsuite.*",
"pyicu.*",
"sacremoses.*",
"sefr_cut.*",
"sentencepiece.*",
"sentence_transformers.*",
"spacy.*",
"spacy_thai.*",
"ssg.*",
"stanza.*",
"symspellpy.*",
"thai_nner.*",
"tltk.*",
"torch.*",
"tqdm.*",
"transformers.*",
"ufal.*",
"ufal.chu_liu_edmonds.*",
"word2word.*",
"wtpsplit.*",
"wunsen.*",
"yaml.*",
]
ignore_missing_imports = true
[tool.pylint.main]
disable = [
"import-error",
"no-name-in-module",
"too-few-public-methods",
"too-many-arguments",
"too-many-locals",
"too-many-branches",
"too-many-statements",
]