Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load pinyin dict #14

Closed
continue-revolution opened this issue Jan 2, 2024 · 8 comments
Closed

Failed to load pinyin dict #14

continue-revolution opened this issue Jan 2, 2024 · 8 comments
Labels
pkg-moegirl zh.moegirl.org.cn packaging related question Further information is requested

Comments

@continue-revolution
Copy link

continue-revolution commented Jan 2, 2024

I am fairly new to fcitx5, so bear with me if this is a silly question. System info: Ubuntu 22.04 + KDE Plasma 5.27

I installed fcitx5 via sudo apt install fcitx5 fcitx5-config-qt fcitx5-chinese-addons and get fcitx5 5.0.14

Then I download your dict and I have /home//.local/share/fcitx5/pinyin/dictionaries/zhwiki-20231205.dict

Then I init fcitx via console (type fcitx5 in command line). From the log, I get

E2024-01-02 04:32:13.970975 pinyin.cpp:764] Failed to load pinyin dict /home/<my username>/.local/share/fcitx5/pinyin/dictionaries/moegirl.dict: Invalid pinyin version.
E2024-01-02 04:32:13.970992 pinyin.cpp:764] Failed to load pinyin dict /home/<my username>/.local/share/fcitx5/pinyin/dictionaries/zhwiki-20231205.dict: Invalid pinyin version.

From my user experience, I cannot observe any import from your dictionary. Any help?

@outloudvi
Copy link
Owner

Hi. Thanks for asking!
For issues related to the "zhwiki" dictionary, please consult felixonmars/fcitx5-pinyin-zhwiki - that's not generated by this project.

@continue-revolution
Copy link
Author

I am already able to import zhwiki by manually building from source, but I have not figured out how to build your repo yet.

It seems that your sample config has relative import. How to run your CLI with your sample config? Is "tweak" necessary?

@continue-revolution
Copy link
Author

continue-revolution commented Jan 2, 2024

Even by manually copy-paste tweak code to config.py produce errors.

2024-01-02 05:33:06,613 [DEBUG] Fetching titles from https://zh.moegirl.org.cn/api.php with a limit of 120
2024-01-02 05:33:06,613 [INFO] Partial session will be saved/read: partial.json
2024-01-02 05:33:06,613 [WARNING] Cannot read partial session: partial.json
Traceback (most recent call last):
  File "/home/conrevo/miniconda3/bin/mw2fcitx", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/conrevo/miniconda3/lib/python3.11/site-packages/mw2fcitx/main.py", line 77, in main
    build(config_object)
  File "/home/conrevo/miniconda3/lib/python3.11/site-packages/mw2fcitx/build_dict.py", line 14, in build
    pipeline.fetch_titles(**config["source"].get("kwargs"))
  File "/home/conrevo/miniconda3/lib/python3.11/site-packages/mw2fcitx/pipeline.py", line 53, in fetch_titles
    titles = fetch_all_titles(self.api_path, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/conrevo/miniconda3/lib/python3.11/site-packages/mw2fcitx/fetch.py", line 85, in fetch_all_titles
    for i in map(lambda x: x["title"], data["query"]["allpages"]):
                                       ~~~~^^^^^^^^^
KeyError: 'query'

Edit: I manually create one partial.json and get

{'error': {'code': 'action-notallowed', 'info': '⧼apierror-action-notallowed⧽', '*': 'See https://zh.moegirl.org.cn/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.'}}

@continue-revolution
Copy link
Author

I finally reach #13 (comment) so I cannot build on my own anyway

the current version in github release might not be compatible with fcitx5 5.0.14

@outloudvi outloudvi added question Further information is requested pkg-moegirl zh.moegirl.org.cn packaging related labels Jan 3, 2024
@outloudvi
Copy link
Owner

As you may have observed from #13, it's currently not working for zh.moegirl.org.cn due to the restriction of that wiki. It should still work on most of the other wikis which allow access to the page list API.

@outloudvi
Copy link
Owner

I am already able to import zhwiki by manually building from source

fcitx-pinyin-zhwiki is using the dump files provided by Wikipedia, and is thus not affected by issues like #13.

the current version in github release might not be compatible with fcitx5 5.0.14

That might be a problem. I'll have a check.

@outloudvi
Copy link
Owner

After looking at felixonmars#34, I noticed that libime-bin on jammy (Ubuntu 22.04) is still on 1.0.11. Given Felix's comment, I guess that older fcitx5 (and libime) on Ubuntu 22.04 may not be able to read compressed .dict built by newer version of libime (1.1.2+).
As you see, .dict from 20231014 is smaller than .dict from 20230914. Therefore, .dicts newer than 20231014 should be all compressed, and thus not usable for fcitx5 on Ubuntu 22.04.
If you want to use newer versions of -moegirl, I think the easiest way is to use mw2fcitx and titles.txt to build a .dict with your version of libime.

@outloudvi
Copy link
Owner

Closing due to inactivity. Please feel free to re-open for further issues on this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg-moegirl zh.moegirl.org.cn packaging related question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants