Source code for redshred.enrichments.sentences

# AUTOGENERATED FILE, DO NOT MANUALLY EDIT

from __future__ import annotations

from enum import Enum
from typing import Any, Literal  # noqa: F401

from pydantic import BaseModel, Field
from pydantic.main import object_setattr

from .base import PerspectiveConfiguration


[docs]class SentencesPerspectiveMethod(str, Enum): nltk = "nltk" spacy = "spacy" pysbd = "pysbd"
[docs]class SentencesPerspectiveConfig(BaseModel): """ Generate preview images for all pages. """ method: SentencesPerspectiveMethod = Field(default="nltk", examples=["nltk", "spacy", "pysbd"])
[docs] class Config: use_enum_values = True arbitrary_types_allowed = True
[docs]class SentencesPerspective(PerspectiveConfiguration): """ Generate preview images for all pages. """ name: Literal["sentences"] = Field(default="sentences") config: SentencesPerspectiveConfig = Field( default_factory=SentencesPerspectiveConfig, description="Specific configuration options for the enrichment" ) def __init__(__pydantic_self__, **data: Any) -> None: super().__init__(**data) # we want to make sure that the _name_ attribute is _always_ serialized even when "exclude_unset" is True object_setattr(__pydantic_self__, "__fields_set__", __pydantic_self__.__fields_set__.union({"name"}))