First off, thank you for considering contributing to the Filipino Tokenizer! It's people like you that make open-source tools for Philippine languages possible.
By participating in this project, you are expected to uphold a welcoming, inclusive, and respectful environment. Be kind to others, and constructive in your feedback.
-
Fork and Clone Fork the repo and clone it locally:
git clone https://github.com/<your-username>/filipino-tokenizer.git cd filipino-tokenizer
-
Virtual Environment Set up your environment and install the package in editable mode with development dependencies:
python -m venv .venv .venv\Scripts\activate # Windows # source .venv/bin/activate # Linux/macOS pip install -e .[dev]
-
Running Tests We use the built-in
unittestframework. Before submitting a PR, ensure all tests pass:python -m unittest discover tests -v
This tokenizer is designed to be extensible to other Philippine languages (Cebuano/Bisaya, Ilokano, Hiligaynon, etc.). To add a new language:
- Update Data Files: Add the affixes for your language to the JSON files in
filipino_tokenizer/data/(e.g.,prefix_table.json). Be sure to specify the"language"key. - Add Roots: Create a root dictionary file (e.g.,
filipino_tokenizer/data/cebuano_roots.json). - Subclass Core Components: Create a new folder (e.g.,
filipino_tokenizer/cebuano/) and implement theAffixes,Roots, andSegmenterclasses by inheriting from theBaseclasses infilipino_tokenizer/base.py. - Implement Phonology: Ensure any language-specific phonological rules (like Tagalog's nasal assimilation) are correctly implemented in your segmenter.
- Create a descriptive branch name (
feat/cebuano-support,fix/cache-bug). - Keep your PRs focused. If you are adding a language, don't mix it with core framework refactoring.
- Write unit tests for your changes. If you add a new phonological rule, add a test for it.
- Fill out the Pull Request template completely.
- Wait for a maintainer to review your code. We will provide constructive feedback!