From efb179d4002e2048c5e900fa0dd6798d87596b89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:45:54 +0000 Subject: [PATCH 1/5] Initial plan From 5d65790790448b34fa3f48f30f79a21655c67239 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:51:21 +0000 Subject: [PATCH 2/5] Fix SPDX header and docstring inconsistencies Co-authored-by: bact <128572+bact@users.noreply.github.com> --- pythainlp/corpus/tnc.py | 2 +- pythainlp/tag/_tag_perceptron.py | 2 +- pythainlp/tokenize/thai2fit.py | 3 +-- pythainlp/tokenize/thaisumcut.py | 2 +- pythainlp/transliterate/thaig2p.py | 12 ++++++++++-- pythainlp/transliterate/thaig2p_v2.py | 11 +++++++++-- pythainlp/transliterate/umt5_thaig2p.py | 11 +++++++++-- pythainlp/util/profanity.py | 3 +-- 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/pythainlp/corpus/tnc.py b/pythainlp/corpus/tnc.py index 7a01849a6..a633709dd 100644 --- a/pythainlp/corpus/tnc.py +++ b/pythainlp/corpus/tnc.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project. +# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project # SPDX-License-Identifier: Apache-2.0 """Thai National Corpus word frequency """ diff --git a/pythainlp/tag/_tag_perceptron.py b/pythainlp/tag/_tag_perceptron.py index d815d64ea..7d5a40001 100644 --- a/pythainlp/tag/_tag_perceptron.py +++ b/pythainlp/tag/_tag_perceptron.py @@ -1,5 +1,4 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project -# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Perceptron Tagger. @@ -9,6 +8,7 @@ Wannaphong Phatthiyaphaibun (PyThaiNLP port) URL: + Copyright 2013 Matthew Honnibal NLTK modifications Copyright 2015 The NLTK Project PyThaiNLP modifications Copyright 2020 PyThaiNLP Project diff --git a/pythainlp/tokenize/thai2fit.py b/pythainlp/tokenize/thai2fit.py index e6f1059f3..abc08f4e0 100644 --- a/pythainlp/tokenize/thai2fit.py +++ b/pythainlp/tokenize/thai2fit.py @@ -1,5 +1,4 @@ -# SPDX-FileCopyrightText: 2026 PyThaiNLP Project -# SPDX-FileType: SOURCE +# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project # SPDX-License-Identifier: Apache-2.0 from functools import lru_cache diff --git a/pythainlp/tokenize/thaisumcut.py b/pythainlp/tokenize/thaisumcut.py index 9981fda64..08ca45360 100644 --- a/pythainlp/tokenize/thaisumcut.py +++ b/pythainlp/tokenize/thaisumcut.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project -# SPDX-FileCopyrightText: Copyright 2020 Nakhun Chumpolsathien +# SPDX-FileCopyrightText: 2020 Nakhun Chumpolsathien # SPDX-License-Identifier: Apache-2.0 """The implementation of sentence segmentator from Nakhun Chumpolsathien, 2020 original codes are from: https://github.com/nakhunchumpolsathien/ThaiSum diff --git a/pythainlp/transliterate/thaig2p.py b/pythainlp/transliterate/thaig2p.py index e3d5c85e5..b4b60c69f 100644 --- a/pythainlp/transliterate/thaig2p.py +++ b/pythainlp/transliterate/thaig2p.py @@ -1,5 +1,4 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project -# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Thai Grapheme-to-Phoneme (Thai G2P) GitHub : https://github.com/wannaphong/thai-g2p @@ -22,7 +21,16 @@ class ThaiG2P: - """Latin transliteration of Thai words, using International Phonetic Alphabet""" + """ + Thai Grapheme-to-Phoneme using PyTorch-based model (v1). + + This is the original Thai G2P model that converts Thai text to + International Phonetic Alphabet (IPA) representation using a custom + PyTorch neural network architecture. + + For more information, see: + https://github.com/wannaphong/thai-g2p + """ def __init__(self): # get the model, download it if it's not available locally diff --git a/pythainlp/transliterate/thaig2p_v2.py b/pythainlp/transliterate/thaig2p_v2.py index aad18c0d4..03c7e3165 100644 --- a/pythainlp/transliterate/thaig2p_v2.py +++ b/pythainlp/transliterate/thaig2p_v2.py @@ -1,5 +1,4 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project -# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Thai Grapheme-to-Phoneme (Thai G2P) @@ -13,7 +12,15 @@ class ThaiG2P: - """Latin transliteration of Thai words, using International Phonetic Alphabet + """ + Thai Grapheme-to-Phoneme using transformer-based model (v2). + + This version uses the Hugging Face transformers pipeline with the + pythainlp/thaig2p-v2.0 model for converting Thai text to International + Phonetic Alphabet (IPA) representation. + + For more information, see: + https://huggingface.co/pythainlp/thaig2p-v2.0 """ def __init__(self, device: str = "cpu"): diff --git a/pythainlp/transliterate/umt5_thaig2p.py b/pythainlp/transliterate/umt5_thaig2p.py index 4976fe547..908766b5b 100644 --- a/pythainlp/transliterate/umt5_thaig2p.py +++ b/pythainlp/transliterate/umt5_thaig2p.py @@ -1,5 +1,4 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project -# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """umt5-thai-g2p-v2-0.5k @@ -13,7 +12,15 @@ class Umt5ThaiG2P: - """Latin transliteration of Thai words, using International Phonetic Alphabet + """ + Thai Grapheme-to-Phoneme using UMT5 model. + + This version uses the B-K/umt5-thai-g2p-v2-0.5k model based on UMT5 + (Unified Multilingual T5) for converting Thai text to International + Phonetic Alphabet (IPA) representation. + + For more information, see: + https://huggingface.co/B-K/umt5-thai-g2p-v2-0.5k """ def __init__(self, device: str = "cpu"): diff --git a/pythainlp/util/profanity.py b/pythainlp/util/profanity.py index 883116c57..7fdeb62fb 100644 --- a/pythainlp/util/profanity.py +++ b/pythainlp/util/profanity.py @@ -1,5 +1,4 @@ -# SPDX-FileCopyrightText: 2026 PyThaiNLP Project -# SPDX-FileType: SOURCE +# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project # SPDX-License-Identifier: Apache-2.0 """ Profanity detection for Thai language From eceb57e26174da2a518833955f087521ca6f5516 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:52:38 +0000 Subject: [PATCH 3/5] Add back SPDX-FileType field per project conventions Co-authored-by: bact <128572+bact@users.noreply.github.com> --- pythainlp/corpus/tnc.py | 1 + pythainlp/tokenize/thai2fit.py | 1 + pythainlp/tokenize/thaisumcut.py | 1 + pythainlp/transliterate/thaig2p.py | 1 + pythainlp/transliterate/thaig2p_v2.py | 1 + pythainlp/transliterate/umt5_thaig2p.py | 1 + pythainlp/util/profanity.py | 1 + 7 files changed, 7 insertions(+) diff --git a/pythainlp/corpus/tnc.py b/pythainlp/corpus/tnc.py index a633709dd..21e359b74 100644 --- a/pythainlp/corpus/tnc.py +++ b/pythainlp/corpus/tnc.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Thai National Corpus word frequency """ diff --git a/pythainlp/tokenize/thai2fit.py b/pythainlp/tokenize/thai2fit.py index abc08f4e0..fab9dac62 100644 --- a/pythainlp/tokenize/thai2fit.py +++ b/pythainlp/tokenize/thai2fit.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 from functools import lru_cache diff --git a/pythainlp/tokenize/thaisumcut.py b/pythainlp/tokenize/thaisumcut.py index 08ca45360..f1dc30f37 100644 --- a/pythainlp/tokenize/thaisumcut.py +++ b/pythainlp/tokenize/thaisumcut.py @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project # SPDX-FileCopyrightText: 2020 Nakhun Chumpolsathien +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """The implementation of sentence segmentator from Nakhun Chumpolsathien, 2020 original codes are from: https://github.com/nakhunchumpolsathien/ThaiSum diff --git a/pythainlp/transliterate/thaig2p.py b/pythainlp/transliterate/thaig2p.py index b4b60c69f..c86609ad0 100644 --- a/pythainlp/transliterate/thaig2p.py +++ b/pythainlp/transliterate/thaig2p.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Thai Grapheme-to-Phoneme (Thai G2P) GitHub : https://github.com/wannaphong/thai-g2p diff --git a/pythainlp/transliterate/thaig2p_v2.py b/pythainlp/transliterate/thaig2p_v2.py index 03c7e3165..6ad4fa381 100644 --- a/pythainlp/transliterate/thaig2p_v2.py +++ b/pythainlp/transliterate/thaig2p_v2.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Thai Grapheme-to-Phoneme (Thai G2P) diff --git a/pythainlp/transliterate/umt5_thaig2p.py b/pythainlp/transliterate/umt5_thaig2p.py index 908766b5b..57e9c7749 100644 --- a/pythainlp/transliterate/umt5_thaig2p.py +++ b/pythainlp/transliterate/umt5_thaig2p.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """umt5-thai-g2p-v2-0.5k diff --git a/pythainlp/util/profanity.py b/pythainlp/util/profanity.py index 7fdeb62fb..d494630f0 100644 --- a/pythainlp/util/profanity.py +++ b/pythainlp/util/profanity.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """ Profanity detection for Thai language From 4332c6dc9f0a07002b596aacb1230873a5876dbb Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Mon, 19 Jan 2026 16:00:58 +0000 Subject: [PATCH 4/5] Add SPDX file type declaration --- pythainlp/tag/_tag_perceptron.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pythainlp/tag/_tag_perceptron.py b/pythainlp/tag/_tag_perceptron.py index 7d5a40001..53de2fd46 100644 --- a/pythainlp/tag/_tag_perceptron.py +++ b/pythainlp/tag/_tag_perceptron.py @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """Perceptron Tagger. From 1da16f78b1ac17cca818ad286c9ea784c6ce49b6 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Mon, 19 Jan 2026 16:05:39 +0000 Subject: [PATCH 5/5] Update profanity.py --- pythainlp/util/profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythainlp/util/profanity.py b/pythainlp/util/profanity.py index d494630f0..883116c57 100644 --- a/pythainlp/util/profanity.py +++ b/pythainlp/util/profanity.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project +# SPDX-FileCopyrightText: 2026 PyThaiNLP Project # SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 """