Skip to content

[WIP] Change default - #1571

Closed
wannaphong wants to merge 64 commits into
mainfrom
change-default
Closed

wannaphong wants to merge 64 commits into
mainfrom
change-default

Conversation

@wannaphong

Copy link
Copy Markdown
Member

Change engine default for PyThaiNLP v6.0

  • Change default transliterate engine to thaig2p_v4

[WIP]

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test

wannaphong and others added 30 commits July 30, 2026 02:02
Upstreaming from v5.3 (v5.3.5)
Upstreaming from 5.3.7 to dev
Add SPDX license information to fastthaig2p.py
Thai G2P v4 model is a Thai grapheme-to-phoneme Conversion model (Thai-to-IPA Conversion) that trained on pythainlp/thai-g2p-v4-dataset.

Hugging Face model and training script: https://huggingface.co/pythainlp/thaig2p-v4
`pythainlp.tokenize.attacut`,`pythainlp.tokenize.oskut`, and  `pythainlp.tokenize.sefr_cut`: migrated to use  [LEKCut](https://github.com/PyThaiNLP/LEKCut) (ONNX), removing legacy  `attacut` (PyTorch), `oskut` (TensorFlow), and `sefr_cut` (TensorFlow)
  package dependencies. The `segment()` APIs remain fully backward compatible.

Attacut tests moved from `tests/noauto_torch/` to `tests/noauto_onnx/`.
Add word tokenization evaluation metrics (`evaluate_word_tokenization`,  `word_eval_function`, `char_eval_function`, `TokenizationScore`) from SEFR CUT (`sefr_cut.evaluation`)  to `pythainlp.benchmarks`.
Change attacut, oskut, and sefr-cut to use LEKCut
Add word tokenization evaluation metrics from SEFR CUT
Remove pythainlp.generate.thai2fit, pythainlp.generate.wangchanglm, and pythainlp.chat
tcc() matched against text[p:], copying the rest of the text for every
character cluster. Match in place with pattern.match(text, p) instead.
This was ~93% of newmm's time on a 608,000-character input.

Co-Authored-By: Claude Code <noreply@anthropic.com>
CI on dev currently fails ruff, mypy, bandit, markdownlint and the
Python 3.9/3.10 unit tests, which hides real regressions in PRs.

- word_tokenization: drop "evaluation" from __all__ (no such name, so
  `from ... import *` raised AttributeError); narrow the input type in
  _normalize_evaluation_input with cast() instead of returning a union.
- wiktionary: only look up tone marks when a tone was found.
- wordtonum, ulmfit.document_vector: add missing annotations.
- fastthaig2p: rename `token` to `chunk` in _email_to_thai (bandit B105
  false positive on `token = ""`).
- tests: sort imports in test_fastthaig2p; remove an unused type: ignore;
  patch thaig2p_v4 through the module object, because on Python < 3.11
  mock.patch("pythainlp.transliterate.thaig2p_v4.transliterate") resolves
  "pythainlp.transliterate" to the re-exported function.
- CHANGELOG.md, corpus_license.md: fix markdownlint errors.

No behavior change intended.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Fix lint, type-check, bandit and markdownlint failures on dev
Migrate CRF models (`han_solo`, `crfchunk_orchidpp`, `thainer`,
  `sentenceseg_crfcut`) to pure weights (`.json.gz`), removing the runtime
  `python-crfsuite` dependency from `compact`.

Thanks Gemini 3.8 Flash!
Add bundled SSG syllable segmentation weights (`ssg.json.gz`) released under  Apache-2.0 from <https://github.com/ponrawee/ssg>.
Fix quadratic slowdown in tcc_p.tcc on long text
bact and others added 26 commits October 7, 2026 14:22
Co-authored-by: bact <128572+bact@users.noreply.github.com>
# Conflicts:
#	CHANGELOG.md
#	pythainlp/phayathaibert/__init__.py
#	pythainlp/phayathaibert/core.py
#	pythainlp/tokenize/core.py
#	pythainlp/ulmfit/__init__.py
#	pythainlp/ulmfit/core.py
#	pythainlp/ulmfit/preprocess.py
#	pythainlp/ulmfit/tokenizer.py
#	pythainlp/wangchanberta/__init__.py
#	pythainlp/wangchanberta/core.py

Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Sync main into dev (model metadata) - #1559
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
- Bump pyproject.toml, __init__.py, CITATION.cff, codemeta.json
- Keep the README version row at the latest release
- Let bump-my-version skip README entries that do not match

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Sync main into dev and set version to 6.0.0-dev0
Move phayathaibert, wangchanberta, and ulmfit to pythainlp.lm
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Add Laya Multilingual to pythainlp.classify
Change default transliterate engine to thaig2p_v4
@wannaphong wannaphong added this to the 6.0 milestone Oct 12, 2026
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@wannaphong wannaphong closed this Oct 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants