feat(trie): TrieCharLegacy, expanded dict-op benchmarks, and real-text e2e benchmarks#105
Open
feat(trie): TrieCharLegacy, expanded dict-op benchmarks, and real-text e2e benchmarks#105
Conversation
…mory usage Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/ced61a05-27d5-495b-9d36-95f890de4e7d Co-authored-by: bact <128572+bact@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/ced61a05-27d5-495b-9d36-95f890de4e7d Co-authored-by: bact <128572+bact@users.noreply.github.com>
…imization comparison Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/8817eaae-abc5-452d-a23d-c93a86288b4d Co-authored-by: bact <128572+bact@users.noreply.github.com>
Sync all changes from main (PR #102 simplify-api and subsequent commits): - New parallel API: segment_with_options(), segment_parallel(), ParallelOptions - Simplified Tokenizer trait (segment only) - tests/data/ benchmark dictionaries (500-short, 500-long, 10k, words_th) - docs/ directory (design.md, implementation.md, BENCHMARK_RESULTS.md) - nlpo3-js renamed from nlpo3-nodejs; Node.js/Python binding updates - CLI dict moved to nlpo3-cli/ Branch-specific changes preserved: - TrieChar memory optimization (HashSet removed, word_count counter used) - Updated BENCHMARK_RESULTS with TrieChar optimization numbers CHANGELOG.md conflict resolved: keep main concise summary + add TrieChar optimization bullet. Co-authored-by: bact <128572+bact@users.noreply.github.com>
…ds, update docs Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/52460a8c-67cc-4866-b08a-0f28882d9b34 Co-authored-by: bact <128572+bact@users.noreply.github.com>
…char-memory Co-authored-by: bact <128572+bact@users.noreply.github.com>
…matrix Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/bf9c80f7-c867-492c-b0ed-e33115b27935 Co-authored-by: bact <128572+bact@users.noreply.github.com>
… FstDict combinations Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/bf9c80f7-c867-492c-b0ed-e33115b27935 Co-authored-by: bact <128572+bact@users.noreply.github.com>
Member
|
@copilot fix this error. see full log at https://github.com/PyThaiNLP/nlpo3/actions/runs/23973204520/job/70328448425?pr=105 |
… TrieChar type param Agent-Logs-Url: https://github.com/PyThaiNLP/nlpo3/sessions/8fc0d129-bbda-47be-830f-af3bc3931828 Co-authored-by: bact <128572+bact@users.noreply.github.com>
Contributor
Author
... Fixed in f03f70b. The ambiguity arose because adding |
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
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.
Preserves the original
HashSet-backed trie asTrieCharLegacywhile promoting the leaner trie (noHashSet) as the defaultTrieChar. Adds a comprehensive benchmark suite covering all threeDictBackendimplementations across real Thai text corpora.Backend changes
TrieCharLegacy— originalTrieChar(trie + parallelHashSet<String>) renamed and kept as a named alternative. O(1)contain()vs O(k) trie walk in newTrieChar; ~12% higher memory (~43 MB vs ~38 MB for 62k words).TrieChar,TrieCharLegacy,FstDict) implementDictBackendand are interchangeable:New benchmarks
dict_operationsgroupcontain / add / remove for all 3 backends × 4 dictionaries (500-short, 500-long, 10k, words_th).
e2e_tokenizationgroup (new — uses real text files fromtests/data/)FstDict with small vocabularies (≤10k words) on large texts is excluded — a low-match-rate vocabulary causes O(n·k·B) fallback processing where FST byte overhead dominates, yielding hundreds of seconds per iteration.
Key findings (measured)
prefix_ref(hot path)contain()contain()is not on the tokenization hot path;TrieCharandTrieCharLegacyhave statistically identical end-to-end throughput.Docs updated
BENCHMARK_RESULTS.md,docs/implementation.md,docs/design.md,CHANGELOG.md— backend comparison tables, complexity analysis, when-to-use guidance.