Reorganise Hungarian punctuation rules

This commit is contained in:
ines 2017-05-09 00:01:59 +02:00
parent fc0d793360
commit 9f0fd5963f

View File

@ -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 +
LIST_ELLIPSES +
LIST_QUOTES)
_suffixes = (LIST_PUNCT + LIST_ELLIPSES + LIST_QUOTES +
TOKENIZER_SUFFIXES = ( [r'(?<=[0-9])\+',
LIST_PUNCT +
LIST_ELLIPSES +
LIST_QUOTES +
[
r'(?<=[0-9])\+',
r'(?<=°[FfCcKk])\.', r'(?<=°[FfCcKk])\.',
r'(?<=[0-9])(?:{c})'.format(c=CURRENCY), r'(?<=[0-9])(?:{})'.format(_currency),
r'(?<=[0-9])(?:{u})'.format(u=UNITS), r'(?<=[0-9])(?:{})'.format(UNITS),
r'(?<=[{al}{p}{c}(?:{q})])\.'.format(al=ALPHA_LOWER, p=r'%²\-\)\]\+', q=QUOTES, c=_currency_symbols), r'(?<=[{}{}{}(?:{})])\.'.format(ALPHA_LOWER, r'%²\-\)\]\+', QUOTES, _currency),
r'(?<=[{al})])-e'.format(al=ALPHA_LOWER)]) r'(?<=[{})])-e'.format(ALPHA_LOWER)])
TOKENIZER_INFIXES = ( _infixes = (LIST_ELLIPSES +
LIST_ELLIPSES + [r'(?<=[{}])\.(?=[{}])'.format(ALPHA_LOWER, ALPHA_UPPER),
[
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}])--(?=[{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(" ", ""))]) r'(?<=[{a}])([{q}\)\]\(\[])(?=[\-{a}])'.format(a=ALPHA, q=_quotes)])
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 TOKENIZER_PREFIXES = _prefixes
TOKENIZER_SUFFIXES = _suffixes
TOKENIZER_INFIXES = _infixes