mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Reorganise Hungarian punctuation rules
This commit is contained in:
parent
fc0d793360
commit
9f0fd5963f
|
@ -1,40 +1,35 @@
|
||||||
# coding: utf8
|
# coding: utf8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from ..punctuation import TOKENIZER_INFIXES
|
||||||
|
from ..char_classes import LIST_PUNCT, LIST_ELLIPSES, LIST_QUOTES, CURRENCY
|
||||||
|
from ..char_classes import QUOTES, UNITS, ALPHA, ALPHA_LOWER, ALPHA_UPPER
|
||||||
|
|
||||||
|
|
||||||
_currency_symbols = r"\$ ¢ £ € ¥ ฿"
|
_currency = r'\$|¢|£|€|¥|฿'
|
||||||
|
_quotes = QUOTES.replace("'", '')
|
||||||
|
|
||||||
|
|
||||||
TOKENIZER_PREFIXES = (
|
_prefixes = ([r'\+'] + LIST_PUNCT + LIST_ELLIPSES + LIST_QUOTES)
|
||||||
[r'\+'] +
|
|
||||||
LIST_PUNCT +
|
_suffixes = (LIST_PUNCT + LIST_ELLIPSES + LIST_QUOTES +
|
||||||
LIST_ELLIPSES +
|
[r'(?<=[0-9])\+',
|
||||||
LIST_QUOTES)
|
r'(?<=°[FfCcKk])\.',
|
||||||
|
r'(?<=[0-9])(?:{})'.format(_currency),
|
||||||
|
r'(?<=[0-9])(?:{})'.format(UNITS),
|
||||||
|
r'(?<=[{}{}{}(?:{})])\.'.format(ALPHA_LOWER, r'%²\-\)\]\+', QUOTES, _currency),
|
||||||
|
r'(?<=[{})])-e'.format(ALPHA_LOWER)])
|
||||||
|
|
||||||
|
|
||||||
TOKENIZER_SUFFIXES = (
|
_infixes = (LIST_ELLIPSES +
|
||||||
LIST_PUNCT +
|
[r'(?<=[{}])\.(?=[{}])'.format(ALPHA_LOWER, ALPHA_UPPER),
|
||||||
LIST_ELLIPSES +
|
r'(?<=[{a}]),(?=[{a}])'.format(a=ALPHA),
|
||||||
LIST_QUOTES +
|
r'(?<=[{a}"])[:<>=](?=[{a}])'.format(a=ALPHA),
|
||||||
[
|
r'(?<=[{a}])--(?=[{a}])'.format(a=ALPHA),
|
||||||
r'(?<=[0-9])\+',
|
r'(?<=[{a}]),(?=[{a}])'.format(a=ALPHA),
|
||||||
r'(?<=°[FfCcKk])\.',
|
r'(?<=[{a}])([{q}\)\]\(\[])(?=[\-{a}])'.format(a=ALPHA, q=_quotes)])
|
||||||
r'(?<=[0-9])(?:{c})'.format(c=CURRENCY),
|
|
||||||
r'(?<=[0-9])(?:{u})'.format(u=UNITS),
|
|
||||||
r'(?<=[{al}{p}{c}(?:{q})])\.'.format(al=ALPHA_LOWER, p=r'%²\-\)\]\+', q=QUOTES, c=_currency_symbols),
|
|
||||||
r'(?<=[{al})])-e'.format(al=ALPHA_LOWER)])
|
|
||||||
|
|
||||||
|
|
||||||
TOKENIZER_INFIXES = (
|
TOKENIZER_PREFIXES = _prefixes
|
||||||
LIST_ELLIPSES +
|
TOKENIZER_SUFFIXES = _suffixes
|
||||||
[
|
TOKENIZER_INFIXES = _infixes
|
||||||
r'(?<=[{al}])\.(?=[{au}])'.format(al=ALPHA_LOWER, au=ALPHA_UPPER),
|
|
||||||
r'(?<=[{a}]),(?=[{a}])'.format(a=ALPHA),
|
|
||||||
r'(?<=[{a}"])[:<>=](?=[{a}])'.format(a=ALPHA),
|
|
||||||
r'(?<=[{a}])--(?=[{a}])'.format(a=ALPHA),
|
|
||||||
r'(?<=[{a}]),(?=[{a}])'.format(a=ALPHA),
|
|
||||||
r'(?<=[{a}])([{q}\)\]\(\[])(?=[\-{a}])'.format(a=ALPHA, q=_QUOTES.replace("'", "").strip().replace(" ", ""))])
|
|
||||||
from ..char_classes import TOKENIZER_INFIXES, LIST_PUNCT LIST_ELLIPSES
|
|
||||||
from ..char_classes import LIST_QUOTES, CURRENCY, QUOTES, UNITS
|
|
||||||
from ..char_classes import ALPHA, ALPHA_LOWER, ALPHA_UPPER
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user