HugoFara / lwt

Learn languages by reading! A language learning app stemmed from Learning with Texts (LWT).
https://hugofara.github.io/lwt/
The Unlicense
164 stars 19 forks source link

[BUG] Mecab not set #182

Closed ProgramComputer closed 6 months ago

ProgramComputer commented 6 months ago

@HugoFara From #155,

I added a new parameter word_parsing (on LWT_DATA.language). That should be a more flexible way to address the issue. For now I don't want to touch the TTS feature any more since it already underwent a massive change with #153, and I don't see bugs for now...

Screenshot 2024-01-02 181512

The bug still exists in c2cb13b. I changed the PR to accommodate the #153. Test or @ProgramComputer for me to test before closing.

Lang_id allows setting mecab independent from language.

Reproduce:

Install LWT. Do not install mecab and don't set "mecab" in regex setting. Open a Japanese text.

HugoFara commented 6 months ago

Hi, I looked at your changes and they were valid but they implied many changes in function signatures. I was also not satisfied with my own previous code relying on global JS variables, as they is always a point where they become messy.

So I changed the signature of speechDispatcher to take a language ID as argument (your suggestion) and I create a new API enpoint (/languages/{lang-id}/reading-configuration) to return the valid data. Now speech dispatcher just asks the server how to read a term.

The supplementary overhead is contained as well: ~500 B and 50ms on average. It supports caching as well, so it won't be concerning.