Spaces:
Sleeping
Sleeping
Update modules/text_analysis/semantic_analysis.py
Browse files
modules/text_analysis/semantic_analysis.py
CHANGED
@@ -283,6 +283,7 @@ def create_concept_graph(doc, key_concepts):
|
|
283 |
return nx.Graph()
|
284 |
|
285 |
###############################################################################
|
|
|
286 |
def visualize_concept_graph(G, lang_code):
|
287 |
try:
|
288 |
# 1. Diccionario de traducciones
|
@@ -363,9 +364,9 @@ def visualize_concept_graph(G, lang_code):
|
|
363 |
# Barra de color (centralidad)
|
364 |
sm = plt.cm.ScalarMappable(
|
365 |
cmap=plt.cm.viridis,
|
366 |
-
norm=plt.Normalize(vmin=0, vmax=1)
|
367 |
sm.set_array([])
|
368 |
-
plt.colorbar(sm, ax=ax, label=translations['concept_centrality'])
|
369 |
|
370 |
# Título del gráfico
|
371 |
plt.title(translations['concept_network'], pad=20, fontsize=14)
|
@@ -378,7 +379,6 @@ def visualize_concept_graph(G, lang_code):
|
|
378 |
logger.error(f"Error en visualize_concept_graph: {str(e)}")
|
379 |
return plt.figure()
|
380 |
|
381 |
-
|
382 |
########################################################################
|
383 |
def create_entity_graph(entities):
|
384 |
G = nx.Graph()
|
|
|
283 |
return nx.Graph()
|
284 |
|
285 |
###############################################################################
|
286 |
+
|
287 |
def visualize_concept_graph(G, lang_code):
|
288 |
try:
|
289 |
# 1. Diccionario de traducciones
|
|
|
364 |
# Barra de color (centralidad)
|
365 |
sm = plt.cm.ScalarMappable(
|
366 |
cmap=plt.cm.viridis,
|
367 |
+
norm=plt.Normalize(vmin=0, vmax=1)
|
368 |
sm.set_array([])
|
369 |
+
plt.colorbar(sm, ax=ax, label=translations['concept_centrality'])
|
370 |
|
371 |
# Título del gráfico
|
372 |
plt.title(translations['concept_network'], pad=20, fontsize=14)
|
|
|
379 |
logger.error(f"Error en visualize_concept_graph: {str(e)}")
|
380 |
return plt.figure()
|
381 |
|
|
|
382 |
########################################################################
|
383 |
def create_entity_graph(entities):
|
384 |
G = nx.Graph()
|