Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -109,7 +109,6 @@ def generate_charts(ner_output_ext: dict) -> Tuple[go.Figure, np.ndarray]:
|
|
109 |
|
110 |
return fig1, wordcloud_image
|
111 |
|
112 |
-
|
113 |
def generate_wordcloud(entities: List[Dict], color_map: Dict[str, str]) -> np.ndarray:
|
114 |
token_texts = []
|
115 |
token_scores = []
|
@@ -117,9 +116,11 @@ def generate_wordcloud(entities: List[Dict], color_map: Dict[str, str]) -> np.nd
|
|
117 |
|
118 |
for entity in entities:
|
119 |
for token in entity['tokens']:
|
120 |
-
|
|
|
121 |
token_scores.append(entity['score'])
|
122 |
token_types.append(entity['entity'])
|
|
|
123 |
|
124 |
# Create a dictionary for word cloud
|
125 |
word_freq = {text: score for text, score in zip(token_texts, token_scores)}
|
|
|
109 |
|
110 |
return fig1, wordcloud_image
|
111 |
|
|
|
112 |
def generate_wordcloud(entities: List[Dict], color_map: Dict[str, str]) -> np.ndarray:
|
113 |
token_texts = []
|
114 |
token_scores = []
|
|
|
116 |
|
117 |
for entity in entities:
|
118 |
for token in entity['tokens']:
|
119 |
+
cleaned_token = token.lstrip('_')
|
120 |
+
token_texts.append(cleaned_token)
|
121 |
token_scores.append(entity['score'])
|
122 |
token_types.append(entity['entity'])
|
123 |
+
print(f"{cleaned_token} ({entity['entity']}): {entity['score']}")
|
124 |
|
125 |
# Create a dictionary for word cloud
|
126 |
word_freq = {text: score for text, score in zip(token_texts, token_scores)}
|