feat(dictionary): Japanese cut into words and looked up on the device
Once the person agrees, the device holds MeCab's IPADIC and the
instance's JMdict and cuts lines as Jisho.org does, so their text never
leaves it (ADR 0012). MeCab comes through mecab_for_dart, whose build
hook compiles it; its tokens are grouped by Ve's rules, written anew in
Dart, with に kept a word of its own. Each word is found as it stands or
as a form of a word, else by its dictionary form, else as the longest
words it holds from token to token; longer words over token boundaries
are offered as before.
The curator packs Ubuntu's compiled IPADIC beside the dictionary files
(curate ipadic, and every update run). The server exports its JMdict
from its tables, so the device finds the same keys and keeps the same
versions, and serves both at /device-dictionaries/, named in
dictionary.deviceFiles('ja') with their hashes; Caddy forwards the path.
The app checks each file against its hash, unpacks IPADIC, builds a
SQLite database from the export on an isolate, and asks the instance
for newer files every 30 days, downloading only what changed. The Watch
screen offers the download once per device with its size (34 MB, some
150 MB once set up); Settings downloads and removes them. Without them,
or should cutting on the device fail, lines go to the instance as
before. MeCab's, IPADIC's and Ve's licences join the licence list.
Every build now needs a C++ compiler; mecab_for_dart holds code_assets
at 1.x.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
8fe2cf3436
commit
1d2011a676
1 changed files with 5487 additions and 245 deletions
|
|
@ -236,6 +236,21 @@ when Wiktionary's Korean file is newer than the Hanja's. Files the curator wrote
|
|||
for a language no longer named, or for a source replaced (Korean's words from
|
||||
Wiktionary, before KRDict), are removed, and the server unloads them.
|
||||
|
||||
Each run also packs MeCab's IPADIC, where the image installed it (Ubuntu's
|
||||
`mecab-ipadic-utf8`, which the Dockerfile installs), into `mecab-ipadic.tar.gz`
|
||||
beside the files: the dictionary the app's devices download from their instance
|
||||
to cut Japanese into words themselves (ADR 0012). The same dictionary always
|
||||
packs to the same bytes, and a pack whose content is unchanged is left as it is
|
||||
(`.mecab-ipadic.tar.gz.sha256` keeps its hash), so devices download it again only
|
||||
when it changed. The server loads no file but dictionary files, so it leaves the
|
||||
pack be, and serves it. By hand, from any compiled IPADIC:
|
||||
|
||||
```sh
|
||||
dart run halkyon_learn_curator:curate ipadic \
|
||||
[--input /var/lib/mecab/dic/ipadic-utf8] \
|
||||
--output ../halkyon_learn_server/dictionaries
|
||||
```
|
||||
|
||||
## The format (`halkyon-dictionary`, version 1)
|
||||
|
||||
[JSON Lines](https://jsonlines.org/), gzipped when the name ends in `.gz`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue