mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
b98d216205
* Update Catalan language data Update Catalan language data based on contributions from the Text Mining Unit at the Barcelona Supercomputing Center: https://github.com/TeMU-BSC/spacy4release/tree/main/lang_data * Update tokenizer settings for UD Catalan AnCora Update for UD Catalan AnCora v2.7 with merged multi-word tokens. * Update test * Move prefix patternt to more generic infix pattern * Clean up
48 lines
1.3 KiB
Python
48 lines
1.3 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"},
|
|
{ORTH: "'l"},
|
|
{ORTH: "'ls"},
|
|
{ORTH: "'m"},
|
|
{ORTH: "'n"},
|
|
{ORTH: "'ns"},
|
|
{ORTH: "'s"},
|
|
{ORTH: "'t"},
|
|
]:
|
|
_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)
|