Add missing docstrings and examples to utility and tokenization functions - #1194
Merged
Conversation
Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update PyThaiNLP documentation for missing functions
Add missing docstrings and examples to utility and tokenization functions
Jan 12, 2026
Member
|
@copilot Here are api that still missing usage examples:
|
- Add examples to reorder_vowels, remove_zw, remove_repeat_vowels - Add examples to th_zodiac, to_lunar_date - Add docstring and examples to Trie class Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
Contributor
Author
Added usage examples to all requested functions in commit f6225a5:
All examples follow the project's Sphinx reST format and have been tested. |
|
wannaphong
marked this pull request as ready for review
January 12, 2026 10:32
wannaphong
approved these changes
Jan 12, 2026
bact
approved these changes
Jan 12, 2026
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 does this changes
Adds complete documentation to 13 public functions that were either missing docstrings entirely or lacking usage examples.
Functions with new complete docstrings:
indices_words()- converts word list to character index pairsmap_indices_to_words()- maps index pairs to words from sentencesTrieclass - Trie data structure for efficient prefix-based word searchFunctions with new examples:
syllable_tokenize()- syllable segmentation with engine optionsTokenizer.word_tokenize()- basic tokenizer usageTokenizer.set_tokenize_engine()- changing tokenization engineconvert_years()- calendar conversions (BE/AD/RE/AH)digit_to_text()- digit-to-Thai-text conversionreorder_vowels()- vowel and tone mark reorderingremove_zw()- zero-width character removalremove_repeat_vowels()- repeated vowel removalth_zodiac()- Thai zodiac year name conversionto_lunar_date()- solar to Thai lunar date conversionAll examples follow existing Sphinx reST conventions with
:Example::sections and working code snippets.What was wrong
Several public API functions lacked docstrings or examples, making them difficult to discover and use without reading source code. Sphinx autodoc generates incomplete API documentation for these functions.
How this fixes it
Adds comprehensive docstrings with:
Examples:
Your checklist for this pull request
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.