Given two sentences, I want to quantify the degree of similarity between the two text-based on Semantic similarity. Semantic Textual Similarity (STS) assesses the degree to which two sentences are semantically equivalent to each other. say my input is of order:
index line1 line2
0 the cat ate the mouse the mouse was eaten by the cat
1 the dog chased the cat the alligator is fat
2 the king ate the cake the cake was ingested by the king
after application of the algorithm , the output needs to be
index line1 line2 lbl
0 the cat ate the mouse the mouse was eaten by the cat 1
1 the dog chased the cat the alligator is fat 0
2 the king ate the cake the cake was ingested by the king 1
Here lbl= 1 means the sentences are semantically similar and lbl=0 means it isn't. How would i implement this in python ? I read the documentation of bert-as-a-service but since i am an absolute noob in this regard I couldn't understand it properly.