I am trying to compare the similarity between two text using a score. This is my code:
risk_list1_txt = []
scoreList = []
similarityDict = {}
theScore = 0
for text1 in risk_list1:
similarityDict['FileName'] = text1
theText1 = open(path1 + "\\" + text1).read().lower()
for text2 in range(len(risk_list2)):
theText2 = open(path2 + "\\" + risk_list2[text2]).read().lower()
theScore = fuzz.token_set_ratio(theText1,theText2)
similarityDict[risk_list2[text2]] = theScore
outFile= open(fileDestDir,'w')
outFile.write(str(theScore))
outFile.close()
the problem is that my outfile is only giving me the score for the last comparison, although I'm having 3 different textfiles in my risk_list1 and risk_list2. I cannot get this loop to function correctly.