HugoFara / lwt

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

Can not open texts of Japanese #94

Closed 99MengXin closed 1 year ago

99MengXin commented 1 year ago

Describe the bug Can not open texts of Japanese.

To Reproduce Steps to reproduce the behavior:

  1. Use master branch
    git clone https://github.com/HugoFara/lwt.git
    cd lwt
    docker compose up -d
  2. Wait for a minute for db building
  3. Go to Languages
  4. Go to New Language
  5. Click on Language Settings Wizard
  6. Click on My native language is: Chinese (Traditional) and I want to study: Japanese
  7. Click on Set Language Settings
  8. Click on Save
  9. Go to Texts
  10. Go to New Text ...
  11. Click on Language and choose Japanese
  12. Click on Title and paste N5レベル
  13. Click on Text and paste 今日、図書館に行きました。
  14. Click on Save and Open
  15. See error

Expected behavior Open the text normally.

Screenshots

截圖 2023-02-20 14 20 30

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Both selections (Regular Expressions and MeCab) of RegExp Word Characters have been tested but fail.

HugoFara commented 1 year ago

Hi!

The issue with MeCab parser says it all: MeCab is not detected, you need to install it separately. Don't forget to install it inside your Docker container 😉

You should be able to use LWT for Japanese only with regular expressions with the results are not so good. What is the error message?

Hope that helps you!

99MengXin commented 1 year ago

Hi, thanks for your swift reply.

I re-bulit container again without MeCab. It was the same error when I chose regular expressions but MeCab.

截圖 2023-02-20 21 20 44

Now the texts of Japanese with MeCab and regular expressions works after installation. 🙂

Could one installation solve two problems?

99MengXin commented 1 year ago

I found 2 ways for docker users to install MeCab from here.

  1. Input 2 commands via Terminal, and change lwt if you named your container with other name.

    docker exec -it lwt bash
    apt-get update && apt-get install -y mecab libmecab-dev mecab-ipadic-utf8
  2. Amended Dockerfile, copy and paste below command at Line No. 8 of Dockerfile.

    RUN apt-get update && apt-get install -y mecab libmecab-dev mecab-ipadic-utf8
HugoFara commented 1 year ago

Thanks for your suggestion! I will add it to the documentation!

HugoFara commented 1 year ago

It was the same error when I chose regular expressions but MeCab

By the way, I noticed another error: the RegExp should alternate between mecab and \x{4E00}-\x{9FFF}\x{F900}-\x{FAFF}\x{3040}-\x{30FF}\x{31F0}-\x{31FF} but I think it wasn't, hence your problem. I pushed a fix right now.