spaCy/spacy/lang/it/__init__.py

36 lines
952 B
Python
Raw Normal View History

from typing import Optional
from thinc.api import Model
2017-05-08 16:50:17 +03:00
from .stop_words import STOP_WORDS
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_INFIXES
2017-05-08 23:29:04 +03:00
from ...language import Language
from .lemmatizer import ItalianLemmatizer
2015-09-06 23:10:37 +03:00
class ItalianDefaults(Language.Defaults):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
stop_words = STOP_WORDS
prefixes = TOKENIZER_PREFIXES
infixes = TOKENIZER_INFIXES
2016-11-02 21:56:32 +03:00
2017-05-03 12:01:42 +03:00
class Italian(Language):
lang = "it"
Defaults = ItalianDefaults
2017-05-03 12:01:42 +03:00
@Italian.factory(
"lemmatizer",
assigns=["token.lemma"],
default_config={"model": None, "mode": "pos_lookup", "overwrite": False},
default_score_weights={"lemma_acc": 1.0},
)
def make_lemmatizer(
nlp: Language, model: Optional[Model], name: str, mode: str, overwrite: bool
):
return ItalianLemmatizer(nlp.vocab, model, name, mode=mode, overwrite=overwrite)
__all__ = ["Italian"]