|
@@ -0,0 +1,86 @@
|
|
|
+import csv
|
|
|
+import codecs
|
|
|
+import pandas as pd
|
|
|
+import re
|
|
|
+import os
|
|
|
+import io
|
|
|
+import tokenize
|
|
|
+
|
|
|
+confronto_data = open('nomi_ceppi.csv', 'w')
|
|
|
+csvwriter = csv.writer(confronto_data)
|
|
|
+
|
|
|
+params = ['recordId', 'segnatura ms.','nameEntry@normal','nameEntry@prime','genere','nome proprio',
|
|
|
+ 'nome di famiglia','patronimico/matronimico','avo 1','avo 2','avo 3','provenienza',
|
|
|
+ 'Variante','Alias','Qualifica','occupation','place_occupation_Qualifica','biogHist p']
|
|
|
+
|
|
|
+csvwriter.writerow(params)
|
|
|
+
|
|
|
+def getIdAspo(nomeProprio, cognome, patronimico, avo1, avo2, avo3):
|
|
|
+ link_file = open('/Users/alessiaspadi/Documents/RESTORE/temp_ASPO/Onomastica_Datini.csv')
|
|
|
+ reader = csv.DictReader(link_file)
|
|
|
+ for row in reader:
|
|
|
+ givenName = row['nome proprio'].lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ familyName = row['nome di famiglia'].lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ patronymic = row['patronimico/matronimico'].lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ relative1 = row['avo 1'].lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ relative2 = row['avo 2'].lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ relative3 = row['avo 2'].lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ np = nomeProprio.lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ ndf = cognome.lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ pm = patronimico.lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ a1 = avo1.lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ a2 = avo2.lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ a3 = avo3.lower().rstrip().lstrip().replace("\n", "")
|
|
|
+ if (givenName == np) and (familyName == ndf) and (patronymic == pm):
|
|
|
+ return row['recordId']
|
|
|
+
|
|
|
+'''and (relative1 == a1) and (relative2 == a2) and (relative3 == a3)'''
|
|
|
+
|
|
|
+merge_file = open('/Users/alessiaspadi/Documents/RESTORE/temp_ASPO/ceppo_vecchio.csv')
|
|
|
+reader = csv.DictReader(merge_file)
|
|
|
+for row in reader:
|
|
|
+ line = []
|
|
|
+ segnatura = row['segnatura ms.']
|
|
|
+ nameEntryNormal = row['nameEntry@normal']
|
|
|
+ nameEntryPrima = row['nameEntry@prime']
|
|
|
+ genere = row['genere']
|
|
|
+ nomeProprio = row['nome proprio']
|
|
|
+ cognome = row['nome di famiglia']
|
|
|
+ patronimico = row['patronimico/matronimico']
|
|
|
+ avo1 = row['avo 1']
|
|
|
+ avo2 = row['avo 2']
|
|
|
+ avo3 = row['avo 3']
|
|
|
+ provenienza = row['provenienza']
|
|
|
+ variante = row['Variante']
|
|
|
+ alias = row['Alias']
|
|
|
+ qualifica = row['Qualifica']
|
|
|
+ occupazione = row['occupation']
|
|
|
+ luogo_occupazione = row['place_occupation_Qualifica']
|
|
|
+ bioghist = row['biogHist p']
|
|
|
+ id_aspo = getIdAspo(nomeProprio, cognome, patronimico, avo1, avo2, avo3)
|
|
|
+
|
|
|
+ if id_aspo is not None:
|
|
|
+ line.append(id_aspo)
|
|
|
+ else:
|
|
|
+ line.append("")
|
|
|
+
|
|
|
+ line.append(segnatura)
|
|
|
+ line.append(nameEntryNormal)
|
|
|
+ line.append(nameEntryPrima)
|
|
|
+ line.append(genere)
|
|
|
+ line.append(nomeProprio)
|
|
|
+ line.append(cognome)
|
|
|
+ line.append(patronimico)
|
|
|
+ line.append(avo1)
|
|
|
+ line.append(avo2)
|
|
|
+ line.append(avo3)
|
|
|
+ line.append(provenienza)
|
|
|
+ line.append(variante)
|
|
|
+ line.append(alias)
|
|
|
+ line.append(qualifica)
|
|
|
+ line.append(occupazione)
|
|
|
+ line.append(luogo_occupazione)
|
|
|
+ line.append(bioghist)
|
|
|
+ csvwriter.writerow(line)
|
|
|
+
|
|
|
+confronto_data.close()
|