I have to extract a database and put it in a script in python. I did it for all name of database. Now I have to calculate the difference of letter between the name 1 and the name 2 and between the name 1 and the name 3 .... and between the name 2 with the name 3 .....
I did it for the moment. I show you what a little part about what I did who gives me a problem :
valeur = []
c.execute("""SELECT NAME FROM AUTHORS""")
rows = c.fetchall()
for row in rows:
valeur.append(row)
x=0
liste=[]
for x in range(len(valeur)):
for i in range(x+1,len(valeur)):
ed = nltk.edit_distance(valeur[x],valeur[i])
dico={"titre":valeur[x],"titre_compare":valeur[i], "distance":ed}
dico["titre"],"&&",(dico["titre_compare"]),"&&",(dico["distance"])
print(dico["titre"],"&&",(dico["titre_compare"]),"&&",(dico["distance"]))
And the result is here
('Khālid Muḥammad ʻAlī al-Ḥājj',) && ('K. Hardono',) && 1
('Khālid Muḥammad ʻAlī al-Ḥājj',) && ('Nūr al-Dīn Ṣammūd',) && 1
('Khālid Muḥammad ʻAlī al-Ḥājj',) && ('Mawlūd Qāsim Nāyit Bulqāsim',) && 1
('Khālid Muḥammad ʻAlī al-Ḥājj',) && ('Ali Ak',) && 1
('Khālid Muḥammad ʻAlī al-Ḥājj',) && ('Nazamī Rāmajī',) && 1
My problems are why I have only 1 at the end of the comparaison between the 2 words and why I have a "," at the end of the words, It should be different and I don't unterstand why I got this. I did the same code of a different database with tittle of books and it worked.
Thanks you very much if you can help me !