2020-07-22 11:42:59 +00:00
|
|
|
from typing import Set, Dict, Callable, Any
|
|
|
|
from thinc.api import Config
|
|
|
|
|
2019-10-18 09:27:38 +00:00
|
|
|
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
|
2019-11-15 15:16:47 +00:00
|
|
|
from .punctuation import TOKENIZER_INFIXES
|
2019-10-14 10:27:50 +00:00
|
|
|
from .lex_attrs import LEX_ATTRS
|
|
|
|
from .stop_words import STOP_WORDS
|
|
|
|
from ...language import Language
|
2020-07-22 20:18:46 +00:00
|
|
|
from ...util import registry
|
2020-07-22 11:42:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_CONFIG = """
|
|
|
|
[nlp]
|
|
|
|
lang = "lb"
|
|
|
|
stop_words = {"@language_data": "spacy.lb.stop_words"}
|
|
|
|
lex_attr_getters = {"@language_data": "spacy.lb.lex_attr_getters"}
|
|
|
|
|
|
|
|
[nlp.lemmatizer]
|
|
|
|
@lemmatizers = "spacy.Lemmatizer.v1"
|
|
|
|
|
2020-07-22 13:59:37 +00:00
|
|
|
[nlp.lemmatizer.data]
|
2020-07-22 11:42:59 +00:00
|
|
|
@language_data = "spacy-lookups-data"
|
|
|
|
lang = ${nlp:lang}
|
2020-07-22 13:59:37 +00:00
|
|
|
tables = ["lemma_lookup"]
|
|
|
|
|
|
|
|
[nlp.vocab_data]
|
|
|
|
@language_data = "spacy-lookups-data"
|
|
|
|
lang = ${nlp:lang}
|
|
|
|
tables = ["lexeme_norm"]
|
2020-07-22 11:42:59 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@registry.language_data("spacy.lb.stop_words")
|
|
|
|
def stop_words() -> Set[str]:
|
|
|
|
return STOP_WORDS
|
|
|
|
|
|
|
|
|
|
|
|
@registry.language_data("spacy.lb.lex_attr_getters")
|
|
|
|
def lex_attr_getters() -> Dict[int, Callable[[str], Any]]:
|
|
|
|
return LEX_ATTRS
|
2019-10-14 10:27:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LuxembourgishDefaults(Language.Defaults):
|
2020-07-22 20:18:46 +00:00
|
|
|
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
|
2019-11-15 15:16:47 +00:00
|
|
|
infixes = TOKENIZER_INFIXES
|
2019-10-18 09:27:38 +00:00
|
|
|
|
2019-10-14 10:27:50 +00:00
|
|
|
|
|
|
|
class Luxembourgish(Language):
|
2019-10-18 09:27:38 +00:00
|
|
|
lang = "lb"
|
2019-10-14 10:27:50 +00:00
|
|
|
Defaults = LuxembourgishDefaults
|
2020-07-22 11:42:59 +00:00
|
|
|
default_config = Config().from_str(DEFAULT_CONFIG)
|
2019-10-14 10:27:50 +00:00
|
|
|
|
|
|
|
|
2019-10-18 09:27:38 +00:00
|
|
|
__all__ = ["Luxembourgish"]
|