Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,9 +162,11 @@ def generate_wordcloud(entities: List[Dict], color_map: Dict[str, str]) -> np.nd
|
|
| 162 |
|
| 163 |
for entity in entities:
|
| 164 |
for token in entity['tokens']:
|
| 165 |
-
|
|
|
|
| 166 |
token_scores.append(entity['score'])
|
| 167 |
token_types.append(entity['entity'])
|
|
|
|
| 168 |
|
| 169 |
# Create a dictionary for word cloud
|
| 170 |
word_freq = {text: score for text, score in zip(token_texts, token_scores)}
|
|
|
|
| 162 |
|
| 163 |
for entity in entities:
|
| 164 |
for token in entity['tokens']:
|
| 165 |
+
cleaned_token = token.lstrip('_')
|
| 166 |
+
token_texts.append(cleaned_token)
|
| 167 |
token_scores.append(entity['score'])
|
| 168 |
token_types.append(entity['entity'])
|
| 169 |
+
print(f"{cleaned_token} ({entity['entity']}): {entity['score']}")
|
| 170 |
|
| 171 |
# Create a dictionary for word cloud
|
| 172 |
word_freq = {text: score for text, score in zip(token_texts, token_scores)}
|