2020-07-22 23:18:46 +03:00
|
|
|
|
from ..tokenizer_exceptions import BASE_EXCEPTIONS
|
2020-07-23 00:09:01 +03:00
|
|
|
|
from ...symbols import ORTH, NORM
|
2020-07-22 23:18:46 +03:00
|
|
|
|
from ...util import update_exc
|
2017-10-12 18:24:20 +03:00
|
|
|
|
|
|
|
|
|
|
2017-11-26 20:54:48 +03:00
|
|
|
|
_exc = {}
|
2017-11-21 11:44:46 +03:00
|
|
|
|
|
2017-11-26 20:54:48 +03:00
|
|
|
|
_abbrev_exc = [
|
|
|
|
|
# Weekdays abbreviations
|
2020-07-23 00:09:01 +03:00
|
|
|
|
{ORTH: "пн", NORM: "понедельник"},
|
|
|
|
|
{ORTH: "вт", NORM: "вторник"},
|
|
|
|
|
{ORTH: "ср", NORM: "среда"},
|
|
|
|
|
{ORTH: "чт", NORM: "четверг"},
|
|
|
|
|
{ORTH: "чтв", NORM: "четверг"},
|
|
|
|
|
{ORTH: "пт", NORM: "пятница"},
|
|
|
|
|
{ORTH: "сб", NORM: "суббота"},
|
|
|
|
|
{ORTH: "сбт", NORM: "суббота"},
|
|
|
|
|
{ORTH: "вс", NORM: "воскресенье"},
|
|
|
|
|
{ORTH: "вскр", NORM: "воскресенье"},
|
|
|
|
|
{ORTH: "воскр", NORM: "воскресенье"},
|
2017-11-26 20:54:48 +03:00
|
|
|
|
# Months abbreviations
|
2020-07-23 00:09:01 +03:00
|
|
|
|
{ORTH: "янв", NORM: "январь"},
|
|
|
|
|
{ORTH: "фев", NORM: "февраль"},
|
|
|
|
|
{ORTH: "февр", NORM: "февраль"},
|
|
|
|
|
{ORTH: "мар", NORM: "март"},
|
|
|
|
|
# {ORTH: "март", NORM: "март"},
|
|
|
|
|
{ORTH: "мрт", NORM: "март"},
|
|
|
|
|
{ORTH: "апр", NORM: "апрель"},
|
|
|
|
|
# {ORTH: "май", NORM: "май"},
|
|
|
|
|
{ORTH: "июн", NORM: "июнь"},
|
|
|
|
|
# {ORTH: "июнь", NORM: "июнь"},
|
|
|
|
|
{ORTH: "июл", NORM: "июль"},
|
|
|
|
|
# {ORTH: "июль", NORM: "июль"},
|
|
|
|
|
{ORTH: "авг", NORM: "август"},
|
|
|
|
|
{ORTH: "сен", NORM: "сентябрь"},
|
|
|
|
|
{ORTH: "сент", NORM: "сентябрь"},
|
|
|
|
|
{ORTH: "окт", NORM: "октябрь"},
|
|
|
|
|
{ORTH: "октб", NORM: "октябрь"},
|
|
|
|
|
{ORTH: "ноя", NORM: "ноябрь"},
|
|
|
|
|
{ORTH: "нояб", NORM: "ноябрь"},
|
|
|
|
|
{ORTH: "нбр", NORM: "ноябрь"},
|
|
|
|
|
{ORTH: "дек", NORM: "декабрь"},
|
2017-11-26 20:54:48 +03:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for abbrev_desc in _abbrev_exc:
|
|
|
|
|
abbrev = abbrev_desc[ORTH]
|
|
|
|
|
for orth in (abbrev, abbrev.capitalize(), abbrev.upper()):
|
2020-07-23 00:09:01 +03:00
|
|
|
|
_exc[orth] = [{ORTH: orth, NORM: abbrev_desc[NORM]}]
|
|
|
|
|
_exc[orth + "."] = [{ORTH: orth + ".", NORM: abbrev_desc[NORM]}]
|
2017-11-26 20:54:48 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_slang_exc = [
|
2020-07-23 00:09:01 +03:00
|
|
|
|
{ORTH: "2к15", NORM: "2015"},
|
|
|
|
|
{ORTH: "2к16", NORM: "2016"},
|
|
|
|
|
{ORTH: "2к17", NORM: "2017"},
|
|
|
|
|
{ORTH: "2к18", NORM: "2018"},
|
|
|
|
|
{ORTH: "2к19", NORM: "2019"},
|
|
|
|
|
{ORTH: "2к20", NORM: "2020"},
|
2017-11-26 20:54:48 +03:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
for slang_desc in _slang_exc:
|
|
|
|
|
_exc[slang_desc[ORTH]] = [slang_desc]
|
|
|
|
|
|
|
|
|
|
|
2020-07-22 23:18:46 +03:00
|
|
|
|
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)
|