2019-02-05 00:39:25 +03:00
|
|
|
|
# coding: utf8
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
2020-03-25 14:28:12 +03:00
|
|
|
|
from ..punctuation import TOKENIZER_PREFIXES as BASE_TOKENIZER_PREFIXES
|
2020-03-25 13:28:02 +03:00
|
|
|
|
from ..char_classes import LIST_ELLIPSES, LIST_ICONS
|
|
|
|
|
from ..char_classes import ALPHA, HYPHENS, CONCAT_QUOTES
|
|
|
|
|
from ..char_classes import ALPHA_LOWER, ALPHA_UPPER
|
2019-02-05 00:39:25 +03:00
|
|
|
|
|
|
|
|
|
|
2020-03-25 13:28:02 +03:00
|
|
|
|
ELISION = "'’"
|
2019-02-05 00:39:25 +03:00
|
|
|
|
|
|
|
|
|
|
2020-03-25 14:28:12 +03:00
|
|
|
|
_prefixes = [r"'[0-9][0-9]", r"[0-9]+°"] + BASE_TOKENIZER_PREFIXES
|
2020-03-25 13:28:02 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_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}])(?:{h})(?=[{al}])".format(a=ALPHA, h=HYPHENS, al=ALPHA_LOWER),
|
|
|
|
|
r"(?<=[{a}0-9])[:<>=\/](?=[{a}])".format(a=ALPHA),
|
2020-03-25 14:28:12 +03:00
|
|
|
|
r"(?<=[{a}][{el}])(?=[{a}0-9\"])".format(a=ALPHA, el=ELISION),
|
2020-03-25 13:28:02 +03:00
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
TOKENIZER_PREFIXES = _prefixes
|
2019-02-05 00:39:25 +03:00
|
|
|
|
TOKENIZER_INFIXES = _infixes
|