Failed initializing MeCab with GenericTagger
Closed this issue · 2 comments
from fugashi import GenericTagger
tagger = GenericTagger()
Then it caused:
Failed initializing MeCab. Please see the README for possible solutions:
https://github.com/polm/fugashi
I can run below code successfully. I already installed pip install mecab-python3
from fugashi import Tagger
tagger = Tagger('-Owakati')
text = "麩菓子は、麩を主材料とした日本の菓子。"
tagger.parse(text)
# => '麩 菓子 は 、 麩 を 主材 料 と し た 日本 の 菓子 。'
for word in tagger(text):
print(word, word.feature.lemma, word.pos, sep='\t')
I am running Anaconda Python 3.8 on Windows. I see issue #32 (comment) similar to mine, but I don't know where fugashi expects the mecabrc is located.
As a quick guess I think the issue is you didn't specify a dictionary when creating your GenericTagger. You need to specify the dictionary directory with -d
.
In more detail...
When submitting an issue please include the complete error output. Pasting the link to the README is not helpful. There should be a part of the error output that says ERROR DETAILS, that's the most important part.
I already installed pip install mecab-python3
You do not need mecab-python3 to use fugashi.
Since you can run the normal Tagger but not the GenericTagger, I assume you have installed unidic-lite or unidic. The normal Tagger is designed to be easy to use so it automatically picks up unidic-lite or unidic. The GenericTagger is more like the default MeCab tagger, so you need to specify the dictionary or mecabrc path. If you do not know where your mecabrc is you probably don't need it.
Why are you attempting to use the GenericTagger?
Closing for lack of response, but please feel free to reply if you're still having issues.