Failed initializing MeCab.
BaranBarbarestani opened this issue · 2 comments
BaranBarbarestani commented
I want to use "fugashi" to tokenize Japanese text. I have already installed "fugashi", "unidic-lite" and "unidic" successfully. This is what I have written:
import fugashi
tagger = fugashi.Tagger('-Owakati')
words = [word.surface for word in tagger(text)]
I have also tried this one:
import fugashi
tagger = fugashi.Tagger()
words = [word.surface for word in tagger(text)]
This is the error I got:
Failed initializing MeCab. Please see the README for possible solutions:
https://github.com/polm/fugashi
If you are still having trouble, please file an issue here, and include the
ERROR DETAILS below:
https://github.com/polm/fugashi/issues
issueを英語で書く必要はありません。
------------------- ERROR DETAILS ------------------------
arguments: [b'fugashi', b'-C', b'-r', b'/Users/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/unidic/dicdir/mecabrc', b'-d', b'/Users/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/unidic/dicdir', b'-Owakati']
error message: param.cpp(69) [ifs] no such file or directory: /Usersi/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/unidic/dicdir/mecabrc
Traceback (most recent call last):
File "/Users/PycharmProjects/pythonProject/Python file.py", line 4, in <module>
tagger = fugashi.Tagger('-Owakati')
File "fugashi/fugashi.pyx", line 313, in fugashi.fugashi.Tagger.__init__
File "fugashi/fugashi.pyx", line 220, in fugashi.fugashi.GenericTagger.__init__
RuntimeError: Failed initializing MeCab
polm commented
You have to run the download step for the unidic package:
python -m unidic download
If you're just starting out, it may be easier to uninstall unidic and just use unidic-lite.
polm commented
Closing this because of lack of followup and I believe the issue is clear, but if you are still having trouble please feel free to reply.