Skip to content

Add smart grammar morphology engine with multi-platform word forms su…#33

Merged
willwade merged 7 commits into
mainfrom
feature/smart-grammar-morphology
Apr 20, 2026
Merged

Add smart grammar morphology engine with multi-platform word forms su…#33
willwade merged 7 commits into
mainfrom
feature/smart-grammar-morphology

Conversation

@willwade
Copy link
Copy Markdown
Collaborator

…pport

Extract POS tags from Grid 3 gridsets and generate morphological inflections (go→goes/going/gone/went, book→books) for vocabulary coverage analysis.

New modules:

  • MorphologyEngine: built-in English rules + pluggable locale rule sets
  • Grid3VerbsParser: reads Grid 3 verbs.zip morphology data for 24+ locales, supports custom directories via parseCustomDirectory() and GRID3_MORPHOLOGY_DIR
  • WordFormGenerator: bridges Grid 3 POS data to AsTeRICS Grid tag-based word forms for cross-platform conversion

Changes:

  • Add pos and wordForms fields to AACButton model
  • GridsetProcessor extracts POS from Action.InsertText commands
  • AstericsGridProcessor preserves word forms and GridActionWordForm actions on import/export (previously discarded)
  • MetricsCalculator auto-detects POS tags (enabled for Grid 3, zero-cost for Snap/TouchChat/OBF)
  • VocabularyAnalyzer.hasWord() checks inflected word forms
  • All tests use synthetic XML fixture (no Grid 3 dependency for CI)

willwade and others added 7 commits April 19, 2026 22:04
…pport

Extract POS tags from Grid 3 gridsets and generate morphological inflections
(go→goes/going/gone/went, book→books) for vocabulary coverage analysis.

New modules:
- MorphologyEngine: built-in English rules + pluggable locale rule sets
- Grid3VerbsParser: reads Grid 3 verbs.zip morphology data for 24+ locales,
  supports custom directories via parseCustomDirectory() and GRID3_MORPHOLOGY_DIR
- WordFormGenerator: bridges Grid 3 POS data to AsTeRICS Grid tag-based word
  forms for cross-platform conversion

Changes:
- Add pos and wordForms fields to AACButton model
- GridsetProcessor extracts POS from Action.InsertText commands
- AstericsGridProcessor preserves word forms and GridActionWordForm actions
  on import/export (previously discarded)
- MetricsCalculator auto-detects POS tags (enabled for Grid 3, zero-cost for
  Snap/TouchChat/OBF)
- VocabularyAnalyzer.hasWord() checks inflected word forms
- All tests use synthetic XML fixture (no Grid 3 dependency for CI)
Builds maps of POS tags and prediction lists from all tree pages, then propagate POS tags to metrics buttons that lack them. For POS-tagged tree buttons with predictions that aren't present in the BFS-reachable metrics set, create synthetic ButtonMetrics (high effort/depth) so their word forms can still be generated. Also fall back to a label-based lookup when resolving a button's parent metrics. This ensures POS and prediction data from topic/unreachable pages are included in metric calculations.
Three issues addressed:

1. POS-tagged buttons on BFS-unreachable pages (e.g. topic pages) were
   ignored because calculateWordFormMetrics required a matching metrics
   entry. Now creates synthetic entries for unreachable POS-tagged buttons
   and also looks up parents by label as a fallback.

2. POS tags from tree buttons are now propagated to metrics buttons when
   the metrics version lacks POS (e.g. the BFS finds a button on a page
   without POS but the same word exists with POS on another page).

3. Buttons without POS tags now get POS inference: checks the irregular
   tables first for confident assignment (Verb/Noun/Adjective/Pronoun),
   then defaults to Noun for untagged single-word content labels. This
   fixes coverage for words like "bird", "tree", "cloud", "thing" that
   exist only on topic pages without POS tagging. A skiplist prevents
   function words from being incorrectly tagged.

Also adds MorphologyEngine.inferPOS() method for POS lookup against
irregular tables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant