Mutual implication score: a symmetric measure of text semantic similarity based on a RoBERTA model pretrained for natural language inference.
Project description
mutual_implication_score
Mutual implication score: a symmetric measure of text semantic similarity based on a RoBERTA model pretrained for natural language inference and fine-tuned for paraphrase detection.
The following snippet illustrates code usage:
from mutual_implication_score import MIS
mis = MIS(device='cpu')
source_texts = ['I want to leave this room',
'Hello world, my name is Nick']
paraphrases = ['I want to go out of this room',
'Hello world, my surname is Petrov']
scores = mis.compute(source_texts, paraphrases)
print(scores)
# expected output: [0.9748, 0.0545]
The first two texts are semantically equivalent, their MIS is close to 1. The two other texts have different meanings, and their score is low.
By default, the model https://huggingface.co/SkolkovoInstitute/Mutual_Implication_Score is used, but you can provide any other compatible model.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mutual_implication_score-0.0.0.tar.gz.
File metadata
- Download URL: mutual_implication_score-0.0.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
512816e65582de6758e2e73b02bdee6324a21cf22a40616210a044e71f63fdc3
|
|
| MD5 |
07621975a7f2f6004c554ceea378907b
|
|
| BLAKE2b-256 |
37d7b1467f01c33395009a4fcc1743f72daf0f3d837a68a947a8d6660ececbd7
|