Use consistent imports and exports

Bundle everything in language_data to keep it consistent with other
languages and make TOKENIZER_EXCEPTIONS importable from there.
This commit is contained in:
ines 2017-02-10 13:34:09 +01:00
parent 21f09d10d7
commit fa3b8512da
3 changed files with 6 additions and 4 deletions

View File

@ -6,7 +6,6 @@ from ..attrs import LANG
from .language_data import *
from .punctuation import TOKENIZER_INFIXES, TOKENIZER_SUFFIXES
from .tokenizer_exceptions import get_tokenizer_exceptions, TOKEN_MATCH
class FrenchDefaults(BaseDefaults):
@ -20,7 +19,7 @@ class FrenchDefaults(BaseDefaults):
@classmethod
def create_tokenizer(cls, nlp=None):
cls.tokenizer_exceptions = get_tokenizer_exceptions()
cls.tokenizer_exceptions = TOKENIZER_EXCEPTIONS
return super(FrenchDefaults, cls).create_tokenizer(nlp)

View File

@ -2,9 +2,10 @@
from __future__ import unicode_literals
from .stop_words import STOP_WORDS
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS, TOKEN_MATCH
STOP_WORDS = set(STOP_WORDS)
__all__ = ["STOP_WORDS"]
__all__ = ["STOP_WORDS", "TOKENIZER_EXCEPTIONS", "TOKEN_MATCH"]

View File

@ -214,4 +214,6 @@ REGULAR_EXP.append(_URL_PATTERN)
TOKEN_MATCH = re.compile('|'.join('({})'.format(m) for m in REGULAR_EXP), re.IGNORECASE).match
__all__ = ("get_tokenizer_exceptions", "TOKEN_MATCH")
TOKENIZER_EXCEPTIONS = get_tokenizer_exceptions()
__all__ = ["TOKENIZER_EXCEPTIONS", "TOKEN_MATCH"]