spaCy/spacy/lang/bn/__init__.py

34 lines
921 B
Python
Raw Normal View History

from typing import Optional
from thinc.api import Model
2017-05-08 13:43:50 +00:00
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIXES
from .stop_words import STOP_WORDS
2017-05-08 20:29:04 +00:00
from ...language import Language
from ...pipeline import Lemmatizer
2017-02-28 01:48:37 +00:00
class BengaliDefaults(Language.Defaults):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
prefixes = TOKENIZER_PREFIXES
suffixes = TOKENIZER_SUFFIXES
infixes = TOKENIZER_INFIXES
stop_words = STOP_WORDS
2017-02-28 01:48:37 +00:00
2017-02-28 15:07:14 +00:00
class Bengali(Language):
lang = "bn"
Defaults = BengaliDefaults
2017-05-03 09:01:42 +00:00
2017-05-08 13:43:50 +00:00
@Bengali.factory(
"lemmatizer",
assigns=["token.lemma"],
default_config={"model": None, "mode": "rule"},
default_score_weights={"lemma_acc": 1.0},
)
def make_lemmatizer(nlp: Language, model: Optional[Model], name: str, mode: str):
return Lemmatizer(nlp.vocab, model, name, mode=mode)
__all__ = ["Bengali"]