TextDocumentEmbedder

A class that provides functionality for embedding text documents and comparing their embeddings.

This class uses a DocumentProvider to extract textual content from a generic document type, and then utilizes an Embedder to convert the text into vector representations (embeddings). The embeddings can be used to analyze or compare the documents.

Parameters

Document

The type representing the document to be processed.

Inheritors

Constructors

Link copied to clipboard
constructor(documentReader: DocumentProvider<Path, Document>, embedder: Embedder)

Functions

Link copied to clipboard
open override fun diff(embedding1: Vector, embedding2: Vector): Double

Calculates the difference between two embeddings using the underlying embedder. Lower values indicate more similarity between the embeddings.

Link copied to clipboard
open suspend override fun embed(document: Document): Vector

Converts the given document into its vector representation.

open suspend override fun embed(text: String): Vector

Embeds the given text into a vector representation.