You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to intialize a Tagger object with an output format that doesn't exist (like -Oasdf) then initialization will fail. On the command line this prints a reasonable error message, but if you call MeCab as a library (like in a wrapper from another language), getGlobalError returns an empty string. This can be confusing if the issue is a typo in the name of an output format or other minor issue.
The root cause of this issue is that when an invalid output format is used the global error message is set twice. First it's set here, in ModelImpl::open:
At this point everything is correct. But this function was called from createTagger, and when that sees that creating the Model failed it sets the error message again, this time to an empty string:
I first became aware of this issue due to trouble in mecab-python3.
An easy fix is to not to set the global error in createTagger. I'm not sure that's always correct, so it might be better to not set the global error if the new error string is empty - a check like that is in one version of setGlobalError already, but not the version normally used.
The text was updated successfully, but these errors were encountered:
If you try to intialize a Tagger object with an output format that doesn't exist (like
-Oasdf
) then initialization will fail. On the command line this prints a reasonable error message, but if you call MeCab as a library (like in a wrapper from another language), getGlobalError returns an empty string. This can be confusing if the issue is a typo in the name of an output format or other minor issue.The root cause of this issue is that when an invalid output format is used the global error message is set twice. First it's set here, in
ModelImpl::open
:mecab/mecab/src/tagger.cpp
Line 375 in 3a07c4e
At this point everything is correct. But this function was called from
createTagger
, and when that sees that creating the Model failed it sets the error message again, this time to an empty string:mecab/mecab/src/tagger.cpp
Line 1052 in 3a07c4e
I first became aware of this issue due to trouble in mecab-python3.
An easy fix is to not to set the global error in
createTagger
. I'm not sure that's always correct, so it might be better to not set the global error if the new error string is empty - a check like that is in one version ofsetGlobalError
already, but not the version normally used.The text was updated successfully, but these errors were encountered: