partially initialized module 'fugashi' has no attribute 'Tagger'
tyknkd opened this issue · 8 comments
I tried to follow your guide: https://www.dampfkraft.com/nlp/how-to-tokenize-japanese.html, but I get this error. What am I doing wrong?
Traceback (most recent call last):
in tagger = fugashi.Tagger()
AttributeError: partially initialized module 'fugashi' has no attribute 'Tagger' (most likely due to a circular import)
Thanks for the report, sorry to hear you're having trouble.
I've never seen that error with fugashi or any other package. What OS and Python version are you running?
Ah, I think I found the cause - did you put your code in a file called fugashi.py
? That could cause the error, you need to use a different filename.
What happens is when Python sees import fugashi
it tries to import a file named fugashi.py
in the same directory first, so you cause a circular import. You can see the explanation here.
https://stackoverflow.com/questions/59762996/how-to-fix-attributeerror-partially-initialized-module
Let me know if that's not your issue.
No worries, that error message is hard to understand.
If you have any other issues please feel free to open an issue any time.
Actually, sorry, I spoke too soon.
Same module 'fugashi' has no attribute 'tagger' error when the file is named something else.
(I'm on Ubuntu 20.10, Python 3.8.6.)
Hm, OK. Can you post the full text of the Traceback? Note that the attribute is Tagger
with a capital T.
Sorry, yet again.
I just realized that I had tried switching it to fugashi.tagger (lowercase t) because VSCode suggested it as a solution.
I changed it back to an uppercase T and now it's fine.
So sorry for all the trouble.
No worries, have fun with fugashi!
Thanks!