Add files
Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
commit
d79a75d352
1 changed files with 24317 additions and 0 deletions
11
good_ai/src/sus/language/is_english.py
Normal file
11
good_ai/src/sus/language/is_english.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from typing import Optional
|
||||
|
||||
from langcodes import standardize_tag, tag_distance
|
||||
|
||||
|
||||
def is_english(language_code: Optional[str]) -> bool:
|
||||
if not language_code:
|
||||
language_code = "und"
|
||||
|
||||
language_code = standardize_tag(language_code)
|
||||
return tag_distance(language_code, "en") < 15
|
||||
Loading…
Reference in a new issue