2020-08-07 13:27:13 +00:00
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
from thinc.api import Model
|
2020-07-22 11:42:59 +00:00
|
|
|
|
2017-05-08 13:51:39 +00:00
|
|
|
from .stop_words import STOP_WORDS
|
2017-09-26 14:39:15 +00:00
|
|
|
from .lex_attrs import LEX_ATTRS
|
2019-04-03 12:13:26 +00:00
|
|
|
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
|
2020-04-06 11:18:07 +00:00
|
|
|
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_INFIXES
|
|
|
|
from .punctuation import TOKENIZER_SUFFIXES
|
2019-08-22 12:21:32 +00:00
|
|
|
from .lemmatizer import DutchLemmatizer
|
2020-08-07 13:27:13 +00:00
|
|
|
from ...lookups import Lookups
|
2017-05-08 20:29:04 +00:00
|
|
|
from ...language import Language
|
2017-05-08 13:51:39 +00:00
|
|
|
|
2016-11-24 14:56:38 +00:00
|
|
|
|
2017-05-20 17:02:27 +00:00
|
|
|
class DutchDefaults(Language.Defaults):
|
2020-07-22 20:18:46 +00:00
|
|
|
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
|
2020-04-06 11:18:07 +00:00
|
|
|
prefixes = TOKENIZER_PREFIXES
|
2019-04-03 12:13:26 +00:00
|
|
|
infixes = TOKENIZER_INFIXES
|
|
|
|
suffixes = TOKENIZER_SUFFIXES
|
2020-07-24 12:50:26 +00:00
|
|
|
lex_attr_getters = LEX_ATTRS
|
|
|
|
stop_words = STOP_WORDS
|
2019-04-03 12:13:26 +00:00
|
|
|
|
2016-11-24 14:56:38 +00:00
|
|
|
|
2017-05-20 17:02:27 +00:00
|
|
|
class Dutch(Language):
|
2019-04-09 09:40:19 +00:00
|
|
|
lang = "nl"
|
2017-05-20 17:02:27 +00:00
|
|
|
Defaults = DutchDefaults
|
2017-05-03 09:01:42 +00:00
|
|
|
|
|
|
|
|
2020-08-07 13:27:13 +00:00
|
|
|
@Dutch.factory(
|
|
|
|
"lemmatizer",
|
|
|
|
assigns=["token.lemma"],
|
|
|
|
default_config={"model": None, "mode": "rule", "lookups": None},
|
|
|
|
scores=["lemma_acc"],
|
|
|
|
default_score_weights={"lemma_acc": 1.0},
|
|
|
|
)
|
|
|
|
def make_lemmatizer(
|
|
|
|
nlp: Language,
|
|
|
|
model: Optional[Model],
|
|
|
|
name: str,
|
|
|
|
mode: str,
|
|
|
|
lookups: Optional[Lookups],
|
|
|
|
):
|
|
|
|
lookups = DutchLemmatizer.load_lookups(nlp.lang, mode, lookups)
|
|
|
|
return DutchLemmatizer(nlp.vocab, model, name, mode=mode, lookups=lookups)
|
|
|
|
|
|
|
|
|
2019-04-09 09:40:19 +00:00
|
|
|
__all__ = ["Dutch"]
|