text-similarity / utils.py
Fariddwi's picture
Upload 6 files
5139c5a
def check_score(probability: float):
return_value = {
"probability": probability,
"score": 0,
}
if 0.95 <= probability <= 1:
return_value["score"] = 4
return return_value
elif 0.89 <= probability <= 0.95:
return_value["score"] = 3
return return_value
elif 0.75 <= probability <= 0.89:
return_value["score"] = 2
return return_value
elif probability <= 0.75:
return_value["score"] = 1
return return_value