mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 02:16:32 +03:00
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from ..tokenizer_exceptions import BASE_EXCEPTIONS
|
|
from ...symbols import ORTH, NORM
|
|
from ...util import update_exc
|
|
|
|
|
|
_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: "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"},
|
|
]:
|
|
_exc[exc_data[ORTH]] = [exc_data]
|
|
|
|
# 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)
|