jattokatarratto commited on
Commit
cb615a2
·
verified ·
1 Parent(s): 1a08c6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -2111,6 +2111,32 @@ def process_row4Linking(row, text_splitter, args, key_geonames, cache_map_geonam
2111
  row['word'], text_splitter, args, key_virtuoso, cache_map_virtuoso, load_map_query_input_output,
2112
  id=iiid, iALLURIScontextFromNCBO=iiiALLURIScontextFromNCBO, UseBioportalForLinking=False,questionText=row[args.source_column])
2113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2114
  else:
2115
  if (row['IsBio'] == 1) or ( (pd.isnull(row["IsBio"]) or row["IsBio"] == '' or row['IsBio'] == 0 or row["IsBio"] is None) and (row['entity_group'] == "MISC") ):
2116
 
 
2111
  row['word'], text_splitter, args, key_virtuoso, cache_map_virtuoso, load_map_query_input_output,
2112
  id=iiid, iALLURIScontextFromNCBO=iiiALLURIScontextFromNCBO, UseBioportalForLinking=False,questionText=row[args.source_column])
2113
 
2114
+ else:
2115
+ # this case is only considered if it is not IsBio or IsGeo or RagMode, etcc..but there is already an annoptation for the NEL coming from NCBO
2116
+ if '@id' in row:
2117
+ # Check if the value is not None or NaN
2118
+ if row['@id'] is not None and not pd.isna(row['@id']):
2119
+ # Assign the value to the variable iiid
2120
+ iiid = row['@id']
2121
+
2122
+ iiiALLURIScontextFromNCBO = None
2123
+ if 'ALLURIScontextFromNCBO' in row:
2124
+ if row['ALLURIScontextFromNCBO'] is not None and isinstance(
2125
+ row['ALLURIScontextFromNCBO'],
2126
+ list): # and not pd.isna(row['ALLURIScontextFromNCBO']):
2127
+ iiiALLURIScontextFromNCBO = row['ALLURIScontextFromNCBO']
2128
+ iiiALLURIScontextFromNCBO = list(set(iiiALLURIScontextFromNCBO))
2129
+
2130
+ if strtobool(args.debug):
2131
+ print(f"\n----- It is not IsBio or IsGeo, but it has id from NCBO ...forcing COMPUTING ... {row['word']} IN THE TEXT:")
2132
+ print(row[args.source_column])
2133
+
2134
+ result, ALLURIScontext, singleContext, globalContext, singleTriples, globalTriples, cache_map_virtuoso, load_map_query_input_output = virtuoso_api_call(
2135
+ row['word'], text_splitter, args, key_virtuoso, cache_map_virtuoso,
2136
+ load_map_query_input_output,
2137
+ id=iiid, iALLURIScontextFromNCBO=iiiALLURIScontextFromNCBO, UseBioportalForLinking=True,
2138
+ questionText=row[args.source_column])
2139
+
2140
  else:
2141
  if (row['IsBio'] == 1) or ( (pd.isnull(row["IsBio"]) or row["IsBio"] == '' or row['IsBio'] == 0 or row["IsBio"] is None) and (row['entity_group'] == "MISC") ):
2142