Spaces:
Sleeping
Sleeping
Update modules/text_analysis/semantic_analysis.py
Browse files
modules/text_analysis/semantic_analysis.py
CHANGED
@@ -56,6 +56,13 @@ POS_TRANSLATIONS = {
|
|
56 |
'NOUN': 'Nom', 'NUM': 'Nombre', 'PART': 'Particule', 'PRON': 'Pronom',
|
57 |
'PROPN': 'Nom Propre', 'SCONJ': 'Conjonction de Subordination', 'SYM': 'Symbole',
|
58 |
'VERB': 'Verbe', 'X': 'Autre',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
}
|
61 |
|
@@ -81,6 +88,13 @@ ENTITY_LABELS = {
|
|
81 |
"Inventions": "lightgreen",
|
82 |
"Dates": "lightyellow",
|
83 |
"Concepts": "lightpink"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
|
@@ -373,13 +387,13 @@ def visualize_concept_graph(G, lang_code, semantic_t):
|
|
373 |
)
|
374 |
#################################################################
|
375 |
# Usar semantic_t para obtener las traducciones
|
376 |
-
plt.title(semantic_t.get('concept_network', '
|
377 |
|
378 |
# Leyenda de centralidad (traducida)
|
379 |
sm = plt.cm.ScalarMappable(cmap=plt.cm.viridis, norm=plt.Normalize(vmin=0, vmax=1))
|
380 |
sm.set_array([])
|
381 |
cbar = plt.colorbar(sm, ax=ax)
|
382 |
-
cbar.set_label(semantic_t.get('concept_centrality', '
|
383 |
|
384 |
ax.set_axis_off()
|
385 |
plt.tight_layout()
|
|
|
56 |
'NOUN': 'Nom', 'NUM': 'Nombre', 'PART': 'Particule', 'PRON': 'Pronom',
|
57 |
'PROPN': 'Nom Propre', 'SCONJ': 'Conjonction de Subordination', 'SYM': 'Symbole',
|
58 |
'VERB': 'Verbe', 'X': 'Autre',
|
59 |
+
},
|
60 |
+
'pt': {
|
61 |
+
'ADJ': 'Adjetivo', 'ADP': 'Preposição', 'ADV': 'Advérbio', 'AUX': 'Auxiliar',
|
62 |
+
'CCONJ': 'Conjunção Coordenativa', 'DET': 'Determinante', 'INTJ': 'Interjeição',
|
63 |
+
'NOUN': 'Substantivo', 'NUM': 'Número', 'PART': 'Partícula', 'PRON': 'Pronome',
|
64 |
+
'PROPN': 'Nome Próprio', 'SCONJ': 'Conjunção Subordinativa', 'SYM': 'Símbolo',
|
65 |
+
'VERB': 'Verbo', 'X': 'Outro',
|
66 |
}
|
67 |
}
|
68 |
|
|
|
88 |
"Inventions": "lightgreen",
|
89 |
"Dates": "lightyellow",
|
90 |
"Concepts": "lightpink"
|
91 |
+
},
|
92 |
+
'pt': {
|
93 |
+
"Pessoas": "lightblue", # Personas/People
|
94 |
+
"Lugares": "lightcoral", # Lugares/Places
|
95 |
+
"Invenções": "lightgreen", # Inventos/Inventions
|
96 |
+
"Datas": "lightyellow", # Fechas/Dates
|
97 |
+
"Conceitos": "lightpink" # Conceptos/Concepts
|
98 |
}
|
99 |
}
|
100 |
|
|
|
387 |
)
|
388 |
#################################################################
|
389 |
# Usar semantic_t para obtener las traducciones
|
390 |
+
plt.title(semantic_t.get('concept_network', 'Relaciones entre los conceptos clave'), pad=20, fontsize=14)
|
391 |
|
392 |
# Leyenda de centralidad (traducida)
|
393 |
sm = plt.cm.ScalarMappable(cmap=plt.cm.viridis, norm=plt.Normalize(vmin=0, vmax=1))
|
394 |
sm.set_array([])
|
395 |
cbar = plt.colorbar(sm, ax=ax)
|
396 |
+
cbar.set_label(semantic_t.get('concept_centrality', 'Centralidad de los conceptos clave"'))
|
397 |
|
398 |
ax.set_axis_off()
|
399 |
plt.tight_layout()
|