# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .favor import Favor


class TextExtractorConfig(UncheckedBaseModel):
    favor: typing.Optional[Favor] = pydantic.Field(default=None)
    """
    Choose whether to prioritize precision or recall when extracting content.
    """

    favor_recall: typing.Optional[bool] = None
    favor_precision: typing.Optional[bool] = None
    no_fallback: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Skip Trafilatura's fallback algorithms for faster scrape though less precise.
    """

    include_comments: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Include comment sections at the bottom of articles.
    """

    include_tables: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Extract text from HTML <table> elements.
    """

    include_formatting: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Keep structural elements related to formatting (<b>/<strong>, <i>/<emph> etc.)
    """

    include_links: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Keep link targets (in href="...") in the extracted content.
    """

    include_images: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Keep track of images along with their targets (<img> attributes: alt, src, title)
    """

    deduplicate: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Helps identify and remove redundant content, such as navigation menus or footers, which are often repeated across the site
    """

    with_metadata: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Extract metadata fields and include them in the output
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
