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
I am doing a translator project that involves automatic language detection, I set up the lingua lib as instructed, however, it exhibited strange behavior during testing.
Here is part of my code:
if source_language == "auto":
detector = LanguageDetectorBuilder.from_all_languages().with_preloaded_language_models().build()
source_language = detector.detect_language_of(text).iso_code_639_1.name.lower()
print(source_language)
if source_language not in ['en', 'zh','ja','ko','fr','de','es','it','pt','ru','tr']:
return "Unsupported language"
And here is the console log:
test string auto zh
nn
Unsupported language
Successful Response auto zh
en
成功回应
Test String auto zh
nn
Unsupported language
This is a Test String auto zh
en
这是一个测试弦。
A Test String auto zh
nn
Unsupported language
Note the lib can successfully detect Successful Response and This is a Test String as English, but it failed to detect test string, Test String, and A Test String.
Is this some kind of edge case, or I am doing something wrong here? Please advise, thanks.
The text was updated successfully, but these errors were encountered:
I am doing a translator project that involves automatic language detection, I set up the lingua lib as instructed, however, it exhibited strange behavior during testing.
Here is part of my code:
And here is the console log:
Note the lib can successfully detect
Successful Response
andThis is a Test String
as English, but it failed to detecttest string
,Test String
, andA Test String
.Is this some kind of edge case, or I am doing something wrong here? Please advise, thanks.
The text was updated successfully, but these errors were encountered: