feat(js): add loadDefaultJapaneseWordParser() and expose ja_word in loadDefaultParsers()
Problem
The ja_word model is bundled and exported from the JavaScript package, but it lacks the convenience loader function and is missing from the loadDefaultParsers() map, making it inaccessible via the CLI's -l flag.
Current Behavior
index.ts exports jaWordModel (the raw model object) but provides no loadDefaultJapaneseWordParser() convenience function. All other four models have one:
- loadDefaultJapaneseParser() → uses ja.json
- loadDefaultSimplifiedChineseParser() → uses zh-hans.json
- loadDefaultTraditionalChineseParser() → uses zh-hant.json
- loadDefaultThaiParser() → uses h.json
- ja_word — no loader function exists
Additionally, loadDefaultParsers() hardcodes only four language entries (ja, zh-hans, zh-hant, h). As a result, the CLI flag -l ja_word\ silently falls back to the default Japanese parser instead of using the word-level model.
The Python CLI supports -l ja_word\ through dynamic filesystem discovery of all .json\ files in the models directory. The JavaScript CLI has no equivalent path.
Expected Behavior
- A loadDefaultJapaneseWordParser() function should be exported from index.ts, consistent with the pattern for all other default parsers.
- loadDefaultParsers() should include the 'ja_word' entry so that the CLI flag -l ja_word\ works correctly.
- The ja_word entry should be listed in the CLI's --help\ output under available languages.
Reproduction
\\ s import { loadDefaultParsers } from 'budoux'; const parsers = loadDefaultParsers(); console.log(parsers.has('ja_word')); // false — should be true \\
Or via CLI: \\ash budoux -l ja_word '今日は天気です。'
Falls back silently to ja model instead of ja_word
\\
Technical Context
- javascript/src/index.ts L18: jaWordModel is imported.
- javascript/src/index.ts L26: jaWordModel is re-exported but no loader function exists.
- javascript/src/index.ts L63-L70: loadDefaultParsers() does not include 'ja_word'.
- The copy-data.js script already copies ja_word.json into src/data/models/ja_word.ts, so the model file is present.
Closing as not planned — please see https://github.com/google/budoux/pull/1489 for details on how experimental models like ja_word are scoped.