incerto.llm.LexicalSimilarity#
- class incerto.llm.LexicalSimilarity[source]#
Bases:
objectMeasure lexical similarity across samples.
Compute exact match rate, token overlap, or edit distance to quantify how similar the generations are.
- __init__()#
Methods
__init__()exact_match_rate(responses[, normalize_fn])Compute fraction of responses that exactly match the most common.
pairwise_token_overlap(responses[, normalize_fn])Average pairwise token overlap (Jaccard similarity).
- static exact_match_rate(responses, normalize_fn=None)[source]#
Compute fraction of responses that exactly match the most common.