Update modules/text_analysis/discourse_analysis.py
Browse files
modules/text_analysis/discourse_analysis.py
CHANGED
|
@@ -250,7 +250,6 @@ def perform_discourse_analysis(text1, text2, nlp, lang):
|
|
| 250 |
# Asegurar limpieza en todos los casos
|
| 251 |
plt.close('all')
|
| 252 |
|
| 253 |
-
|
| 254 |
#################################################################
|
| 255 |
def create_concept_table(key_concepts):
|
| 256 |
"""
|
|
@@ -268,41 +267,3 @@ def create_concept_table(key_concepts):
|
|
| 268 |
logger.error(f"Error en create_concept_table: {str(e)}")
|
| 269 |
raise
|
| 270 |
|
| 271 |
-
#################
|
| 272 |
-
def perform_discourse_analysis(text1, text2, nlp, lang):
|
| 273 |
-
"""
|
| 274 |
-
Realiza el an谩lisis completo del discurso
|
| 275 |
-
Args:
|
| 276 |
-
text1: Primer texto a analizar
|
| 277 |
-
text2: Segundo texto a analizar
|
| 278 |
-
nlp: Modelo de spaCy cargado
|
| 279 |
-
lang: C贸digo de idioma
|
| 280 |
-
Returns:
|
| 281 |
-
dict: Resultados del an谩lisis
|
| 282 |
-
"""
|
| 283 |
-
try:
|
| 284 |
-
# Realizar an谩lisis comparativo
|
| 285 |
-
fig1, fig2, key_concepts1, key_concepts2 = compare_semantic_analysis(
|
| 286 |
-
text1, text2, nlp, lang
|
| 287 |
-
)
|
| 288 |
-
|
| 289 |
-
# Crear tablas de resultados
|
| 290 |
-
table1 = create_concept_table(key_concepts1)
|
| 291 |
-
table2 = create_concept_table(key_concepts2)
|
| 292 |
-
|
| 293 |
-
return {
|
| 294 |
-
'graph1': fig1,
|
| 295 |
-
'graph2': fig2,
|
| 296 |
-
'key_concepts1': key_concepts1,
|
| 297 |
-
'key_concepts2': key_concepts2,
|
| 298 |
-
'table1': table1,
|
| 299 |
-
'table2': table2,
|
| 300 |
-
'success': True
|
| 301 |
-
}
|
| 302 |
-
|
| 303 |
-
except Exception as e:
|
| 304 |
-
logger.error(f"Error en perform_discourse_analysis: {str(e)}")
|
| 305 |
-
return {
|
| 306 |
-
'success': False,
|
| 307 |
-
'error': str(e)
|
| 308 |
-
}
|
|
|
|
| 250 |
# Asegurar limpieza en todos los casos
|
| 251 |
plt.close('all')
|
| 252 |
|
|
|
|
| 253 |
#################################################################
|
| 254 |
def create_concept_table(key_concepts):
|
| 255 |
"""
|
|
|
|
| 267 |
logger.error(f"Error en create_concept_table: {str(e)}")
|
| 268 |
raise
|
| 269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|