Spaces:
Sleeping
Sleeping
File size: 663 Bytes
8144c2e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from thefuzz import fuzz
from deep_translator import GoogleTranslator
import time
def gg_score(original, translation, target="en"):
while True:
try:
back_original = GoogleTranslator(source='auto', target=target).translate(translation)
gg_translation = GoogleTranslator(source='auto', target=target).translate(original)
break
except:
time.sleep(1)
continue
return (fuzz.token_set_ratio(original, back_original) + fuzz.token_set_ratio(gg_translation, translation))/200
def miner_score(translation, grouth):
return fuzz.token_set_ratio(translation, grouth)/100 |