mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-14 21:57:15 +03:00
37 lines
964 B
Python
37 lines
964 B
Python
from ..char_classes import LIST_ELLIPSES, LIST_ICONS, LIST_PUNCT, LIST_QUOTES
|
|
from ..char_classes import CURRENCY, UNITS, PUNCT
|
|
from ..char_classes import CONCAT_QUOTES, ALPHA, ALPHA_LOWER, ALPHA_UPPER
|
|
|
|
|
|
_infixes = (
|
|
LIST_ELLIPSES
|
|
+ LIST_ICONS
|
|
+ [
|
|
r"(?<=[0-9])[+\-\*^](?=[0-9-])",
|
|
r"(?<=[{al}{q}])\.(?=[{au}{q}])".format(
|
|
al=ALPHA_LOWER, au=ALPHA_UPPER, q=CONCAT_QUOTES
|
|
),
|
|
r"(?<=[{a}]),(?=[{a}])".format(a=ALPHA),
|
|
r"(?<=[{a}0-9])[:<>=/](?=[{a}])".format(a=ALPHA),
|
|
]
|
|
)
|
|
|
|
_suffixes = (
|
|
LIST_PUNCT
|
|
+ LIST_ELLIPSES
|
|
+ LIST_QUOTES
|
|
+ LIST_ICONS
|
|
+ [
|
|
r"(?<=[0-9])\+",
|
|
r"(?<=°[FfCcKk])\.",
|
|
r"(?<=[0-9])(?:{c})".format(c=CURRENCY),
|
|
r"(?<=[0-9])(?:{u})".format(u=UNITS),
|
|
r"(?<=[{a}{e}{p}(?:{q})])\.".format(
|
|
a=ALPHA, e=r"%²\-\+", q=CONCAT_QUOTES, p=PUNCT
|
|
),
|
|
]
|
|
)
|
|
|
|
TOKENIZER_INFIXES = _infixes
|
|
TOKENIZER_SUFFIXES = _suffixes
|