mirror of
https://github.com/magnum-opus-tender-hack/backend.git
synced 2025-02-19 19:00:32 +03:00
add eng spell
This commit is contained in:
parent
eecc1976f9
commit
92a3d71c9b
|
@ -1,10 +1,17 @@
|
||||||
import requests as r
|
import requests as r
|
||||||
from spellchecker import SpellChecker
|
from spellchecker import SpellChecker
|
||||||
|
|
||||||
speller = SpellChecker(language='ru')
|
speller_ru = SpellChecker(language='ru')
|
||||||
|
speller_eng = SpellChecker(language='en')
|
||||||
|
|
||||||
def spell_check(word: str) -> str:
|
def spell_check_ru(word: str) -> str:
|
||||||
res = speller.correction(word)
|
res = speller_ru.correction(word)
|
||||||
|
if not len(res):
|
||||||
|
return word
|
||||||
|
return res
|
||||||
|
|
||||||
|
def spell_check_en(word: str) -> str:
|
||||||
|
res = speller_ru.correction(word)
|
||||||
if not len(res):
|
if not len(res):
|
||||||
return word
|
return word
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in New Issue
Block a user