Function convertTextToEmbedding

  • Text embeddings convert words or phrases into numerical vectors in a high-dimensional space, where each dimension represents a semantic feature extracted by a model like MiniLM-L6-v2. In this concept space, words with similar meanings have vectors that are close together, allowing for quantitative comparisons of semantic similarity. These vector representations enable powerful applications in natural language processing, including semantic search, text classification, and clustering, by leveraging the geometric properties of the embedding space to capture and analyze the relationships between words and concepts. Text Embeddings, Classification, and Semantic Search (Youtube)


    Parameters

    • text: string

      The text to embed.

    • Optionaloptions: {
          pipeline: AutoTokenizer;
          precision: number;
      } = {}
      • pipeline: AutoTokenizer

        The pipeline to use for embedding.

      • precision: number

        default=4 - The number of decimal places to round to.

    Returns Promise<{
        embeddingsDict: {};
        embedding: number[];
    }>