spaCy/spacy/lang/tt/tokenizer_exceptions.py
Daniël de Kok e2b70df012
Configure isort to use the Black profile, recursively isort the spacy module (#12721)
* Use isort with Black profile

* isort all the things

* Fix import cycles as a result of import sorting

* Add DOCBIN_ALL_ATTRS type definition

* Add isort to requirements

* Remove isort from build dependencies check

* Typo
2023-06-14 17:48:41 +02:00

48 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from ...symbols import NORM, ORTH
from ...util import update_exc
from ..tokenizer_exceptions import BASE_EXCEPTIONS
_exc = {}
_abbrev_exc = [
# Weekdays abbreviations
{ORTH: "дш", NORM: "дүшәмбе"},
{ORTH: "сш", NORM: "сишәмбе"},
{ORTH: "чш", NORM: "чәршәмбе"},
{ORTH: "пш", NORM: "пәнҗешәмбе"},
{ORTH: "җм", NORM: "җомга"},
{ORTH: "шб", NORM: "шимбә"},
{ORTH: "яш", NORM: "якшәмбе"},
# Months abbreviations
{ORTH: "гый", NORM: "гыйнвар"},
{ORTH: "фев", NORM: "февраль"},
{ORTH: "мар", NORM: "март"},
{ORTH: "мар", NORM: "март"},
{ORTH: "апр", NORM: "апрель"},
{ORTH: "июн", NORM: "июнь"},
{ORTH: "июл", NORM: "июль"},
{ORTH: "авг", NORM: "август"},
{ORTH: "сен", NORM: "сентябрь"},
{ORTH: "окт", NORM: "октябрь"},
{ORTH: "ноя", NORM: "ноябрь"},
{ORTH: "дек", NORM: "декабрь"},
# Number abbreviations
{ORTH: "млрд", NORM: "миллиард"},
{ORTH: "млн", NORM: "миллион"},
]
for abbr in _abbrev_exc:
for orth in (abbr[ORTH], abbr[ORTH].capitalize(), abbr[ORTH].upper()):
_exc[orth] = [{ORTH: orth, NORM: abbr[NORM]}]
_exc[orth + "."] = [{ORTH: orth + ".", NORM: abbr[NORM]}]
for exc_data in [ # "etc." abbreviations
{ORTH: "һ.б.ш.", NORM: "һәм башка шундыйлар"},
{ORTH: "һ.б.", NORM: "һәм башка"},
{ORTH: "б.э.к.", NORM: "безнең эрага кадәр"},
{ORTH: "б.э.", NORM: "безнең эра"},
]:
_exc[exc_data[ORTH]] = [exc_data]
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)