More ngrams#1138
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds explicit ngramFile configuration to language definitions (rather than deriving the filename from dictionaryFile), enabling next-word prediction support per language as part of issue #851. It also tweaks soft-key behavior (new edit-text icon/command for RF3, fixing SoftKeyNumberSwipeable to use a new COLLECTION_SWIPE command collection) and changes the MindReader seeding flow to handle languages without spaces between words via a new setTokens() method. The UsageStatsScreen truncation now also resets the per-language ngrams revision so factory n-grams are re-imported.
Changes:
- Replace derived ngram file paths with an explicit
ngramFile:property on every language YAML; wire it through gradle parsing and validation. - Add
MindReaderContext.setTokens()for pre-tokenized seeding (non-space languages) and refactorMindReader.seed()accordingly; drop the unused return value fromsetContext(). - Introduce
COLLECTION_SWIPEcommand set (including cut/copy/paste), newic_fn_edit_texticon, and use the edit-text command's icon inSoftKeyRF3.
Reviewed changes
Copilot reviewed 45 out of 49 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| CONTRIBUTING.md | Documents the new optional ngramFile property. |
| app/build.gradle, app/build-dictionaries.gradle, app/build-ngrams.gradle, app/validate-languages.gradle | Pass ngramsInputDir through gradle helpers; parse and validate the new ngramFile key. |
| app/languages/definitions/*.yml | Add ngramFile: entry for each language. |
| app/src/main/java/io/github/sspanak/tt9/languages/LanguageDefinition.java | Parse ngramFile and use it for getNgramsFile(). |
| app/src/main/java/io/github/sspanak/tt9/ime/mindreader/MindReaderContext.java | Add tokenized flag and setTokens(); tokenize() now skips re-tokenizing pre-set tokens. |
| app/src/main/java/io/github/sspanak/tt9/ime/mindreader/MindReader.java | Use setTokens() for languages without spaces during factory n-gram seeding; remove unused return from setContext(). |
| app/src/main/java/io/github/sspanak/tt9/preferences/screens/UsageStatsScreen.java | Reset factory ngrams revision after truncating MindReader tables. |
| app/src/main/java/io/github/sspanak/tt9/commands/CommandCollection.java | Add COLLECTION_SWIPE with cut/copy/paste in addition to hotkeys. |
| app/src/main/java/io/github/sspanak/tt9/commands/CmdEditText.java | Use the new edit-text icon. |
| app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyRF3.java | Show the edit-text icon (instead of cut) as the central icon. |
| app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumberSwipeable.java | Look up swipe commands from COLLECTION_SWIPE instead of hotkeys. |
| app/src/main/res/drawable/ic_fn_edit_text.xml | New edit-text vector drawable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2c58e05 to
9729373
Compare
Part of #851