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 13:50:17 +00:00
from .stop_words import STOP_WORDS
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_INFIXES
2017-05-08 20:29:04 +00:00
from ...language import Language
from .lemmatizer import ItalianLemmatizer
2015-09-06 20:10:37 +00:00
class ItalianDefaults(Language.Defaults):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
stop_words = STOP_WORDS
prefixes = TOKENIZER_PREFIXES
infixes = TOKENIZER_INFIXES
2016-11-02 18:56:32 +00:00
2017-05-03 09:01:42 +00:00
class Italian(Language):
lang = "it"
Defaults = ItalianDefaults
2017-05-03 09:01:42 +00: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"]