Repository navigation
Fix stray space in longest tokenizer "า" rule - #1609
Open
KittiphonKamnuan wants to merge 2 commits into
Open
KittiphonKamnuan wants to merge 2 commits into
KittiphonKamnuan wants to merge 2 commits into
Conversation
wannaphong
requested changes
Nov 20, 2026
wannaphong
left a comment
Member
There was a problem hiding this comment.
Thank you for the bug fix! Can you send this patch to the main branch?
`_FRONT_DEP_CHAR` held "า " (with a trailing space), so an unknown "า" never joined the previous token, while "ะ" did. - Change "า " to "า" in `pythainlp/tokenize/longest.py` - Update the pinning test to assert the fixed behavior - Remove the `longest-front-dep-typo` entry from the bug ledger
KittiphonKamnuan
force-pushed
the
fix/longest-front-dep-typo
branch
from
November 20, 2026 17:35
dd9e1ae to
1fd17d0
Compare
Author
|
Thanks! Rebased onto |
Author
|
Thanks for approving the workflows. About the failing checks:
Could you re-run the workflows now that the base is |
The longest engine no longer leaves a lone "า", so etcc.segment() no longer reaches the merge step in _cut_subword(). Call it directly to keep it covered.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What do these changes do
Fix the
longest-front-dep-typoentry in the bug ledger (working-docs/ROADMAP.md): with thelongestengine, an unknown "า" now joins the previous token, like "ะ" already does.What was wrong
_FRONT_DEP_CHARinpythainlp/tokenize/longest.pyheld"า "(with a trailing space)._is_dependent_char()tests a single character within, so "า" never matched. With dictionary["ก", "ข"],"กา"returned["ก", "า"].How this fixes it
"า "to"า"."กา"→["กา"],"กาข"→["กา", "ข"]), and check that every entry in_FRONT_DEP_CHARis one character long.# BUG-LEDGERmarker and the ledger entry; add a change log entry.Behavior check: I compared
longest.segment()output before and after on 1,158 texts (sample sentences plus dictionary words followed by a stray "า"). Every changed output is a stray "า" joining the previous token (e.g."กาาาา":["กา", "าาา"]→["กาาาา"]). Text without a stray "า" is unchanged.Your checklist for this pull request
ruff check,ruff format --check)python -m unittest tests.core: 753 tests OK, 33 skipped)🤖 Generated with Claude Code