Created
August 22, 2023 12:50
-
-
Save srsani/76595766f721a8a392d3ace6df11542e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dict_distance (dict1:dict, | |
dict2:dict) -> float: | |
distance_list = [] | |
character_length = [] | |
for key, value in dict1.items(): | |
distance_list.append(edit_distance(dict1[key].strip(), | |
dict2[key].strip())) | |
if len(dict1[key]) > len(dict2[key]): | |
character_length.append((len(dict1[key]))) | |
if len(dict2[key]) >= len(dict1[key]): | |
character_length.append((len(dict2[key]))) | |
accuracy = 100 - sum(distance_list)/(sum(character_length))*100 | |
return accuracy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment