File size: 879 Bytes
fda57dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
"""
Source: https://github.com/ZurichNLP/recognizing-semantic-differences
MIT License
Copyright (c) 2023 University of Zurich
"""
from typing import List
from tqdm import tqdm
from recognizers.utils import DifferenceSample
class DifferenceRecognizer:
def __str__(self):
raise NotImplemented
def predict(self,
a: str,
b: str,
**kwargs,
) -> DifferenceSample:
raise NotImplemented
def predict_all(self,
a: List[str],
b: List[str],
**kwargs,
) -> List[DifferenceSample]:
assert len(a) == len(b)
predictions = []
for i in tqdm(list(range(len(a)))):
prediction = self.predict(a[i], b[i], **kwargs)
predictions.append(prediction)
return predictions
|