spaCy/spacy/lang/ky/tokenizer_exceptions.py

54 lines
2.0 KiB
Python
Raw Normal View History

2021-01-27 02:29:22 +00:00
from ..tokenizer_exceptions import BASE_EXCEPTIONS
2021-01-27 11:11:42 +00:00
from ...symbols import ORTH, NORM
2021-01-27 02:29:22 +00:00
from ...util import update_exc
2021-01-22 17:08:41 +00:00
_exc = {}
_abbrev_exc = [
# Weekdays abbreviations
2021-01-27 11:11:42 +00:00
{ORTH: "дүй", NORM: "дүйшөмбү"},
{ORTH: "шей", NORM: "шейшемби"},
{ORTH: "шар", NORM: "шаршемби"},
{ORTH: "бей", NORM: "бейшемби"},
{ORTH: "жум", NORM: "жума"},
{ORTH: "ишм", NORM: "ишемби"},
{ORTH: "жек", NORM: "жекшемби"},
2021-01-22 17:08:41 +00:00
# Months abbreviations
2021-01-27 11:11:42 +00:00
{ORTH: "янв", NORM: "январь"},
{ORTH: "фев", NORM: "февраль"},
{ORTH: "мар", NORM: "март"},
{ORTH: "апр", NORM: "апрель"},
{ORTH: "июн", NORM: "июнь"},
{ORTH: "июл", NORM: "июль"},
{ORTH: "авг", NORM: "август"},
{ORTH: "сен", NORM: "сентябрь"},
{ORTH: "окт", NORM: "октябрь"},
{ORTH: "ноя", NORM: "ноябрь"},
{ORTH: "дек", NORM: "декабрь"},
2021-01-22 17:08:41 +00:00
# Number abbreviations
2021-01-27 11:11:42 +00:00
{ORTH: "млрд", NORM: "миллиард"},
{ORTH: "млн", NORM: "миллион"},
2021-01-22 17:08:41 +00:00
]
for abbr in _abbrev_exc:
for orth in (abbr[ORTH], abbr[ORTH].capitalize(), abbr[ORTH].upper()):
2021-01-27 11:11:42 +00:00
_exc[orth] = [{ORTH: orth, NORM: abbr[NORM]}]
_exc[orth + "."] = [{ORTH: orth + ".", NORM: abbr[NORM]}]
2021-01-22 17:08:41 +00:00
for exc_data in [ # "etc." abbreviations
{ORTH: "ж.б.у.с.", NORM: "жана башка ушул сыяктуу"},
{ORTH: "ж.б.", NORM: "жана башка"},
{ORTH: "ж.", NORM: "жыл"},
{ORTH: "б.з.ч.", NORM: "биздин заманга чейин"},
{ORTH: "б.з.", NORM: "биздин заман"},
{ORTH: "кк.", NORM: "кылымдар"},
{ORTH: "жж.", NORM: "жылдар"},
{ORTH: "к.", NORM: "кылым"},
{ORTH: "көч.", NORM: "көчөсү"},
{ORTH: "м-н", NORM: "менен"},
{ORTH: "б-ча", NORM: "боюнча"},
2021-01-30 01:52:33 +00:00
]:
_exc[exc_data[ORTH]] = [exc_data]
2021-01-22 17:08:41 +00:00
2021-01-27 02:29:22 +00:00
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)