Toggle Menu
Prev Up Next

# `langchain_community.document_transformers.html2text`.Html2TextTransformer

class langchain_community.document_transformers.html2text.Html2TextTransformer(ignore_links: bool = True, ignore_images: bool = True)

  Replace occurrences of a particular search pattern with a replacement string

  Parameters

    - ignore_links (bool) – Whether links should be ignored; defaults to True.

    - ignore_images (bool) – Whether images should be ignored; defaults to True.

  Example

  Methods

  `__init__`([ignore_links, ignore_images]) |
  `atransform_documents`(documents, **kwargs) | Asynchronously transform a list of documents.
  `transform_documents`(documents, **kwargs) | Transform a list of documents.

  __init__(ignore_links: bool = True, ignore_images: bool = True) → None
    Parameters

      - ignore_links (bool) –

      - ignore_images (bool) –

    Return type

      None

  async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]

    Asynchronously transform a list of documents.

    Parameters

      - documents (Sequence[Document]) – A sequence of Documents to be transformed.

      - kwargs (Any) –

    Returns

      A list of transformed Documents.

    Return type

      Sequence[Document]

  transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]

    Transform a list of documents.

    Parameters

      - documents (Sequence[Document]) – A sequence of Documents to be transformed.

      - kwargs (Any) –

    Returns

      A list of transformed Documents.

    Return type

      Sequence[Document]

# Examples using Html2TextTransformer

- # activeloop token is needed if you are not signed in using CLI: `activeloop login -u <USERNAME> -p <PASSWORD>`

- Set env var OPENAI_API_KEY or load from a .env file:

- async_chromium.md

- html2text.md