Update modules/text_analysis/discourse_analysis.py
Browse files
modules/text_analysis/discourse_analysis.py
CHANGED
|
@@ -18,13 +18,15 @@ logger = logging.getLogger(__name__)
|
|
| 18 |
from .semantic_analysis import (
|
| 19 |
create_concept_graph,
|
| 20 |
visualize_concept_graph,
|
| 21 |
-
identify_key_concepts
|
|
|
|
| 22 |
)
|
| 23 |
|
| 24 |
from .stopwords import (
|
| 25 |
get_custom_stopwords,
|
| 26 |
process_text,
|
| 27 |
-
get_stopwords_for_spacy
|
|
|
|
| 28 |
)
|
| 29 |
|
| 30 |
|
|
@@ -86,26 +88,6 @@ ENTITY_LABELS = {
|
|
| 86 |
}
|
| 87 |
|
| 88 |
#################
|
| 89 |
-
def fig_to_bytes(fig):
|
| 90 |
-
"""
|
| 91 |
-
Convierte una figura de matplotlib a bytes en formato PNG.
|
| 92 |
-
|
| 93 |
-
Args:
|
| 94 |
-
fig: Figura de matplotlib
|
| 95 |
-
|
| 96 |
-
Returns:
|
| 97 |
-
bytes: Representaci贸n en bytes de la figura en formato PNG
|
| 98 |
-
"""
|
| 99 |
-
try:
|
| 100 |
-
import io
|
| 101 |
-
buf = io.BytesIO()
|
| 102 |
-
fig.savefig(buf, format='png', dpi=100, bbox_inches='tight')
|
| 103 |
-
buf.seek(0)
|
| 104 |
-
return buf.getvalue()
|
| 105 |
-
except Exception as e:
|
| 106 |
-
logger.error(f"Error al convertir figura a bytes: {str(e)}")
|
| 107 |
-
return None
|
| 108 |
-
|
| 109 |
|
| 110 |
#################
|
| 111 |
def compare_semantic_analysis(text1, text2, nlp, lang):
|
|
|
|
| 18 |
from .semantic_analysis import (
|
| 19 |
create_concept_graph,
|
| 20 |
visualize_concept_graph,
|
| 21 |
+
identify_key_concepts,
|
| 22 |
+
|
| 23 |
)
|
| 24 |
|
| 25 |
from .stopwords import (
|
| 26 |
get_custom_stopwords,
|
| 27 |
process_text,
|
| 28 |
+
get_stopwords_for_spacy,
|
| 29 |
+
fig_to_bytes
|
| 30 |
)
|
| 31 |
|
| 32 |
|
|
|
|
| 88 |
}
|
| 89 |
|
| 90 |
#################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
#################
|
| 93 |
def compare_semantic_analysis(text1, text2, nlp, lang):
|