Update modules/text_analysis/discourse_analysis.py
Browse files
modules/text_analysis/discourse_analysis.py
CHANGED
@@ -22,7 +22,6 @@ from .semantic_analysis import (
|
|
22 |
create_concept_graph,
|
23 |
visualize_concept_graph,
|
24 |
identify_key_concepts,
|
25 |
-
fig_to_bytes
|
26 |
)
|
27 |
|
28 |
|
@@ -92,7 +91,16 @@ ENTITY_LABELS = {
|
|
92 |
}
|
93 |
|
94 |
#################
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
#################
|
97 |
def compare_semantic_analysis(text1, text2, nlp, lang):
|
98 |
"""
|
|
|
22 |
create_concept_graph,
|
23 |
visualize_concept_graph,
|
24 |
identify_key_concepts,
|
|
|
25 |
)
|
26 |
|
27 |
|
|
|
91 |
}
|
92 |
|
93 |
#################
|
94 |
+
def fig_to_bytes(fig):
|
95 |
+
"""Convierte una figura de matplotlib a bytes."""
|
96 |
+
try:
|
97 |
+
buf = io.BytesIO()
|
98 |
+
fig.savefig(buf, format='png', dpi=300, bbox_inches='tight')
|
99 |
+
buf.seek(0)
|
100 |
+
return buf.getvalue()
|
101 |
+
except Exception as e:
|
102 |
+
logger.error(f"Error en fig_to_bytes: {str(e)}")
|
103 |
+
return None
|
104 |
#################
|
105 |
def compare_semantic_analysis(text1, text2, nlp, lang):
|
106 |
"""
|