langchain.prompts.example_selector.ngram_overlap.ngram_overlap_score

langchain.prompts.example_selector.ngram_overlap.ngram_overlap_score(source: List[str], example: List[str]) float[source]

Compute ngram overlap score of source and example as sentence_bleu score.

Use sentence_bleu with method1 smoothing function and auto reweighting. Return float value between 0.0 and 1.0 inclusive. https://www.nltk.org/_modules/nltk/translate/bleu_score.html https://aclanthology.org/P02-1040.pdf