Update lang_detect.py
Browse files- lang_detect.py +1 -1
lang_detect.py
CHANGED
@@ -10,7 +10,7 @@ def detect_language(text):
|
|
10 |
"de": ("Deutsch", "German"), "hi": ("हिन्दी", "Hindi"), "zh": ("中文", "Chinese"),
|
11 |
"ar": ("العربية", "Arabic"), "ru": ("Русский", "Russian"), "ja": ("日本語", "Japanese")
|
12 |
}
|
13 |
-
detected_options = [(native_lang_map.get(lang.lang, ("Auto-detect", "Auto-detect"))[
|
14 |
return detected_options[:1] if detected_options else [("Auto-detect", 0.5, "Auto-detect")]
|
15 |
except Exception:
|
16 |
return [("Auto-detect", 0.5, "Auto-detect")]
|
|
|
10 |
"de": ("Deutsch", "German"), "hi": ("हिन्दी", "Hindi"), "zh": ("中文", "Chinese"),
|
11 |
"ar": ("العربية", "Arabic"), "ru": ("Русский", "Russian"), "ja": ("日本語", "Japanese")
|
12 |
}
|
13 |
+
detected_options = [(native_lang_map.get(lang.lang, ("Auto-detect", "Auto-detect"))[0], lang.prob, native_lang_map.get(lang.lang, ("Auto-detect", "Auto-detect"))[1]) for lang in lang_detections if lang.prob >= 0.2]
|
14 |
return detected_options[:1] if detected_options else [("Auto-detect", 0.5, "Auto-detect")]
|
15 |
except Exception:
|
16 |
return [("Auto-detect", 0.5, "Auto-detect")]
|