WindowContextCompressor

class WindowContextCompressor(windowChars: Int = 100, maxSnippets: Int = 3, maxTotalChars: Int = 500) : ContextCompressor

Extracts a window of text around each mention of the entity.

Parameters

windowChars

Characters before and after each mention to include

maxSnippets

Maximum number of snippets to include

maxTotalChars

Maximum total characters in compressed output

Constructors

Link copied to clipboard
constructor(windowChars: Int = 100, maxSnippets: Int = 3, maxTotalChars: Int = 500)

Functions

Link copied to clipboard
open override fun compress(sourceText: String?, entityName: String): String?

Compress source text to extract relevant context for entity resolution.

Link copied to clipboard
open fun compressForAll(sourceText: String?, entityNames: List<String>): String?

Compress source text for multiple entities at once. May be more efficient than calling compress repeatedly.