INNER CODE UNIT · Swift
distance
ZachNagengast/similarity-search-kit · Sources/SimilaritySearchKit/Core/Embeddings/EmbeddingProtocols.swift:55
func distance(between firstEmbedding: [Float], and secondEmbedding: [Float]) -> Float
}
public protocol TextSplitterProtocol {
/// Splits the input text into a tuple of chunks and optionally token ids.
///
/// - Parameters:
/// - text: The input text to be chunked.
/// - chunkSize: The number of tokens per chunk.
/// - overlapSize: The number of overlapping tokens between consecutive chunks.
/// - Returns: A tuple containing an array of chunked text and an optional array of token ids.
func split(text: String, chunkSize: Int, overlapSize: Int) -> ([String], [[String]]?)
}
public protocol TokenizerProtocol {
func tokenize(text: String) -> [String]
func detokenize(tokens: [String]) -> String
}