mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-14 21:57:15 +03:00
e2b70df012
* 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
68 lines
1.9 KiB
Python
Executable File
68 lines
1.9 KiB
Python
Executable File
from ...symbols import NORM, ORTH
|
|
from ...util import update_exc
|
|
from ..tokenizer_exceptions import BASE_EXCEPTIONS
|
|
|
|
_exc = {}
|
|
|
|
for exc_data in [
|
|
{ORTH: "aprox.", NORM: "aproximadament"},
|
|
{ORTH: "pàg.", NORM: "pàgina"},
|
|
{ORTH: "p.ex.", NORM: "per exemple"},
|
|
{ORTH: "gen.", NORM: "gener"},
|
|
{ORTH: "feb.", NORM: "febrer"},
|
|
{ORTH: "abr.", NORM: "abril"},
|
|
{ORTH: "jul.", NORM: "juliol"},
|
|
{ORTH: "set.", NORM: "setembre"},
|
|
{ORTH: "oct.", NORM: "octubre"},
|
|
{ORTH: "nov.", NORM: "novembre"},
|
|
{ORTH: "dec.", NORM: "desembre"},
|
|
{ORTH: "Dr.", NORM: "doctor"},
|
|
{ORTH: "Dra.", NORM: "doctora"},
|
|
{ORTH: "Sr.", NORM: "senyor"},
|
|
{ORTH: "Sra.", NORM: "senyora"},
|
|
{ORTH: "Srta.", NORM: "senyoreta"},
|
|
{ORTH: "núm", NORM: "número"},
|
|
{ORTH: "St.", NORM: "sant"},
|
|
{ORTH: "Sta.", NORM: "santa"},
|
|
{ORTH: "pl.", NORM: "plaça"},
|
|
{ORTH: "à."},
|
|
{ORTH: "è."},
|
|
{ORTH: "é."},
|
|
{ORTH: "í."},
|
|
{ORTH: "ò."},
|
|
{ORTH: "ó."},
|
|
{ORTH: "ú."},
|
|
{ORTH: "'l"},
|
|
{ORTH: "'ls"},
|
|
{ORTH: "'m"},
|
|
{ORTH: "'n"},
|
|
{ORTH: "'ns"},
|
|
{ORTH: "'s"},
|
|
{ORTH: "'t"},
|
|
]:
|
|
_exc[exc_data[ORTH]] = [exc_data]
|
|
|
|
_exc["del"] = [{ORTH: "d", NORM: "de"}, {ORTH: "el"}]
|
|
_exc["dels"] = [{ORTH: "d", NORM: "de"}, {ORTH: "els"}]
|
|
|
|
_exc["al"] = [{ORTH: "a"}, {ORTH: "l", NORM: "el"}]
|
|
_exc["als"] = [{ORTH: "a"}, {ORTH: "ls", NORM: "els"}]
|
|
|
|
_exc["pel"] = [{ORTH: "p", NORM: "per"}, {ORTH: "el"}]
|
|
_exc["pels"] = [{ORTH: "p", NORM: "per"}, {ORTH: "els"}]
|
|
|
|
_exc["holahola"] = [{ORTH: "holahola", NORM: "cocacola"}]
|
|
|
|
|
|
# Times
|
|
_exc["12m."] = [{ORTH: "12"}, {ORTH: "m.", NORM: "p.m."}]
|
|
|
|
for h in range(1, 12 + 1):
|
|
for period in ["a.m.", "am"]:
|
|
_exc[f"{h}{period}"] = [{ORTH: f"{h}"}, {ORTH: period, NORM: "a.m."}]
|
|
for period in ["p.m.", "pm"]:
|
|
_exc[f"{h}{period}"] = [{ORTH: f"{h}"}, {ORTH: period, NORM: "p.m."}]
|
|
|
|
|
|
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)
|