2020-07-22 20:18:46 +00:00
|
|
|
|
from ..tokenizer_exceptions import BASE_EXCEPTIONS
|
2020-07-22 21:09:01 +00:00
|
|
|
|
from ...symbols import ORTH, NORM
|
2020-07-22 20:18:46 +00:00
|
|
|
|
from ...util import update_exc
|
2019-08-22 09:43:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_exc = {}
|
|
|
|
|
|
|
|
|
|
_abbrev_exc = [
|
|
|
|
|
# Weekdays abbreviations
|
2020-07-22 21:09:01 +00:00
|
|
|
|
{ORTH: "пoн", NORM: "понедељак"},
|
|
|
|
|
{ORTH: "уто", NORM: "уторак"},
|
|
|
|
|
{ORTH: "сре", NORM: "среда"},
|
|
|
|
|
{ORTH: "чет", NORM: "четвртак"},
|
|
|
|
|
{ORTH: "пет", NORM: "петак"},
|
|
|
|
|
{ORTH: "суб", NORM: "субота"},
|
|
|
|
|
{ORTH: "нед", NORM: "недеља"},
|
2019-08-22 09:43:07 +00:00
|
|
|
|
# Months abbreviations
|
2020-07-22 21:09:01 +00: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: "децембар"},
|
2019-08-22 09:43:07 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for abbrev_desc in _abbrev_exc:
|
|
|
|
|
abbrev = abbrev_desc[ORTH]
|
|
|
|
|
for orth in (abbrev, abbrev.capitalize(), abbrev.upper()):
|
2020-07-22 21:09:01 +00:00
|
|
|
|
_exc[orth] = [{ORTH: orth, NORM: abbrev_desc[NORM]}]
|
|
|
|
|
_exc[orth + "."] = [{ORTH: orth + ".", NORM: abbrev_desc[NORM]}]
|
2019-08-22 09:43:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# common abbreviations
|
|
|
|
|
_slang_exc = [
|
|
|
|
|
# without dot
|
2020-07-22 21:09:01 +00: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: "хектолитар"},
|
2019-08-22 09:43:07 +00:00
|
|
|
|
# with dot
|
2020-07-22 21:09:01 +00: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: "ове године"},
|
|
|
|
|
{ORTH: "л.к.", NORM: "лична карта"},
|
|
|
|
|
{ORTH: "в.д.", NORM: "вршилац дужности"},
|
|
|
|
|
{ORTH: "стр.", NORM: "страна"},
|
2019-08-22 09:43:07 +00:00
|
|
|
|
# with qoute
|
2020-07-22 21:09:01 +00:00
|
|
|
|
{ORTH: "ал'", NORM: "али"},
|
|
|
|
|
{ORTH: "ил'", NORM: "или"},
|
|
|
|
|
{ORTH: "је л'", NORM: "је ли"},
|
|
|
|
|
{ORTH: "да л'", NORM: "да ли"},
|
|
|
|
|
{ORTH: "држ'те", NORM: "држите"},
|
2019-08-22 09:43:07 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
for slang_desc in _slang_exc:
|
|
|
|
|
_exc[slang_desc[ORTH]] = [slang_desc]
|
|
|
|
|
|
|
|
|
|
|
2020-07-22 20:18:46 +00:00
|
|
|
|
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)
|