mirror of
https://github.com/magnum-opus-tender-hack/backend.git
synced 2024-11-27 19:53:42 +03:00
change translate
This commit is contained in:
parent
c9ad0a1e7a
commit
eecc1976f9
|
@ -1,3 +1,4 @@
|
||||||
DJANGO_DEBUG=yes
|
DJANGO_DEBUG=yes
|
||||||
DATABASE_URL=postgres://postgres:debug@127.0.0.1:5432/tenderhack
|
DATABASE_URL=postgres://postgres:debug@127.0.0.1:5432/tenderhack
|
||||||
CELERY_BROKER_URL=redis://localhost:6379/0
|
CELERY_BROKER_URL=redis://localhost:6379/0
|
||||||
|
YANDEX_DICT=<your_yandex_dict_api_key>
|
|
@ -1,4 +1,5 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
|
||||||
import environ
|
import environ
|
||||||
|
|
||||||
|
@ -38,6 +39,8 @@ LOCALE_PATHS = [str(APPS_DIR / "locale")]
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||||
DATABASES = {"default": env.db("DATABASE_URL")}
|
DATABASES = {"default": env.db("DATABASE_URL")}
|
||||||
DATABASES["default"]["ATOMIC_REQUESTS"] = True
|
DATABASES["default"]["ATOMIC_REQUESTS"] = True
|
||||||
|
YANDEX_DICT_API_KEY = env.str('YANDEX_DICT')
|
||||||
|
|
||||||
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD
|
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import requests as r
|
import requests as r
|
||||||
|
from spellchecker import SpellChecker
|
||||||
|
|
||||||
|
speller = SpellChecker(language='ru')
|
||||||
|
|
||||||
def spell_check(word: str) -> str:
|
def spell_check(word: str) -> str:
|
||||||
res = r.get(f'https://speller.yandex.net/services/spellservice.json/checkText?text={word}')
|
res = speller.correction(word)
|
||||||
return res.json()[0]['s'][0]
|
if not len(res):
|
||||||
|
return word
|
||||||
|
return res
|
||||||
|
|
|
@ -10,3 +10,5 @@ redis==4.3.4
|
||||||
psycopg2-binary==2.9.4
|
psycopg2-binary==2.9.4
|
||||||
|
|
||||||
celery==5.2.7
|
celery==5.2.7
|
||||||
|
|
||||||
|
pyspellchecker==0.7.0
|
Loading…
Reference in New Issue
Block a user