Similarity Functions
Available functions:
edit_distance_score(text1, text2): Calculate the edit distance score between two texts.bleu_score(reference, candidate): Calculate the BLEU score between a reference sentence and a candidate sentence.jaccard_similarity_score(text1, text2): Calculate Jaccard similarity between two texts.sorensen_dice_coefficient(text1, text2): Calculate the Sorensen-Dice coefficient between two texts.cosine_similarity_score(text1, text2): Calculate the cosine similarity between two texts.mean_squared_error(image1, image2): Calculate the mean squared error (MSE) between two images.psnr(image1, image2): Calculate the peak signal-to-noise ratio (PSNR) between two images.
Edit distance score
Calculate the edit distance score between two texts.
Parameters:
- `text1` (str): The first text.
- `text2` (str): The second text.
Returns:
- `int`: The edit distance score.BLEU Score
Calculate the BLEU score between a reference sentence and a candidate sentence.
Jaccard Similarity Score
Jaccard similarity is a measure of similarity between two sets. In the context of text comparison, it calculates the similarity between the sets of words in two texts.
Sorensen-Dice Coefficient
The Sorensen-Dice coefficient is a statistic used for comparing the similarity of two samples.
Cosine Similarity Score
Cosine similarity is a measure of similarity between two non-zero vectors of an inner product space that measures the cosine of the angle between them.
Mean Squared Error
MSE is a measure of the average squared difference between the estimated values and the actual value.
PSNR
PSNR is the ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation.
Last updated
Was this helpful?