Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -156,9 +156,12 @@ Non-organised entities with entiities.json
|
|
156 |
entities = self.entity_df.entity
|
157 |
self.related_entity = []
|
158 |
match_scores = []
|
159 |
-
for name, entity in zip(names, entities):
|
160 |
if entity in ('PERSON','ORG','GPE','NORP','LOC'):
|
161 |
related_names = wikipedia.search(name, 10)
|
|
|
|
|
|
|
162 |
self.related_entity.append(related_names)
|
163 |
matches = process.extract(name, related_names)
|
164 |
match_scores.append([match[0] for match in matches if match[1]>= 90 ])
|
@@ -170,6 +173,7 @@ Non-organised entities with entiities.json
|
|
170 |
self.entity_df['Wikipedia Entity'] = self.related_entity
|
171 |
self.entity_df['Matched Entity'] = match_scores
|
172 |
|
|
|
173 |
def fuzzy_disambiguation(self):
|
174 |
# Load the entity data
|
175 |
self.entity_df['fuzzy_match'] = ''
|
|
|
156 |
entities = self.entity_df.entity
|
157 |
self.related_entity = []
|
158 |
match_scores = []
|
159 |
+
for i, (name, entity) in enumerate(zip(names, entities)):
|
160 |
if entity in ('PERSON','ORG','GPE','NORP','LOC'):
|
161 |
related_names = wikipedia.search(name, 10)
|
162 |
+
# Implementing logic for getting related names instead of original text
|
163 |
+
if related_names:
|
164 |
+
names.iloc[i] = related_names[0]
|
165 |
self.related_entity.append(related_names)
|
166 |
matches = process.extract(name, related_names)
|
167 |
match_scores.append([match[0] for match in matches if match[1]>= 90 ])
|
|
|
173 |
self.entity_df['Wikipedia Entity'] = self.related_entity
|
174 |
self.entity_df['Matched Entity'] = match_scores
|
175 |
|
176 |
+
|
177 |
def fuzzy_disambiguation(self):
|
178 |
# Load the entity data
|
179 |
self.entity_df['fuzzy_match'] = ''
|