|
@@ -69,6 +69,8 @@ class basicQueries:
|
|
|
parole = 31
|
|
|
listOcc = self.listOcc
|
|
|
contexts = []
|
|
|
+ minChar_list = []
|
|
|
+ maxChar_list = []
|
|
|
for ind, row in textlist.iterrows():
|
|
|
sigla = row["sigla"]
|
|
|
queryData = {'queryType': 'contexts', 'ntxlocal': row["ntx"], 'mappalocal': row['mappa'], 'parole': parole}
|
|
@@ -77,9 +79,15 @@ class basicQueries:
|
|
|
queryData['table'] = table
|
|
|
queryresponse = self.queryHandler.query(queryData, pandas=True)
|
|
|
pointerlist = pd.concat([pointerlist, queryresponse])
|
|
|
- fileQueryData = {'sigla': sigla, 'minChar': pointerlist["pitxt"].min(), 'maxChar': pointerlist["pitxt"].max()}
|
|
|
+ minChar = pointerlist["pitxt"].min()
|
|
|
+ maxChar = pointerlist["pitxt"].max()
|
|
|
+ fileQueryData = {'sigla': sigla, 'minChar': minChar, 'maxChar': maxChar}
|
|
|
+ minChar_list.append(minChar)
|
|
|
+ maxChar_list.append(maxChar)
|
|
|
cont = self.queryHandler.textQuery(fileQueryData)
|
|
|
contexts.append(cont)
|
|
|
+ textlist['minChar'] = minChar_list
|
|
|
+ textlist['maxChar'] = maxChar_list
|
|
|
textlist['contesto'] = contexts
|
|
|
return (textlist.reset_index(drop=True))
|
|
|
|
|
@@ -133,9 +141,8 @@ class basicQueries:
|
|
|
clean_df = chrono.reindex(columns=cols + list(chrono.columns.difference(cols)))
|
|
|
return (clean_df.reset_index(drop=True))
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- def highlight (self, bibliocontexts):
|
|
|
+
|
|
|
+ '''def highlight (self, bibliocontexts):
|
|
|
index = 0
|
|
|
for col in bibliocontexts.columns:
|
|
|
forme = []
|
|
@@ -152,6 +159,19 @@ class basicQueries:
|
|
|
highlight_cols = bibliocontexts.filter(regex='^highlight')
|
|
|
create_array = lambda row: highlight_cols.loc[row.name].values.tolist()
|
|
|
bibliocontexts['highlights_combined'] = highlight_cols.apply(create_array, axis=1)
|
|
|
+ return bibliocontexts'''
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ def highlight (self, bibliocontexts):
|
|
|
+ index = 0
|
|
|
+ for col in bibliocontexts.columns:
|
|
|
+ if col.startswith('pitxt'):
|
|
|
+ if index == 0:
|
|
|
+ bibliocontexts['highlight'] = bibliocontexts.apply (lambda row: [row['pitxt'] - row['minChar'], row['elemlen']], axis=1)
|
|
|
+ else:
|
|
|
+ bibliocontexts['highlight_'+str(index)] = bibliocontexts.apply (lambda row: [row['pitxt_'+str(index)] - row['minChar'], row['elemlen_'+str(index)]], axis=1)
|
|
|
+ index += 1
|
|
|
return bibliocontexts
|
|
|
|
|
|
|