Spaces:
Sleeping
Sleeping
Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
|
@@ -10,6 +10,8 @@ from ..database.current_situation_mongo_db import store_current_situation_result
|
|
| 10 |
# Importaciones locales
|
| 11 |
from translations import get_translations
|
| 12 |
|
|
|
|
|
|
|
| 13 |
from .current_situation_analysis import (
|
| 14 |
analyze_text_dimensions,
|
| 15 |
analyze_clarity,
|
|
@@ -326,138 +328,10 @@ def display_radar_chart(metrics_config, thresholds):
|
|
| 326 |
|
| 327 |
#####################################################
|
| 328 |
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
'structure': '#28B463', # Verde
|
| 337 |
-
'cohesion': '#F39C12', # Naranja
|
| 338 |
-
'clarity': '#9B59B6', # Púrpura
|
| 339 |
-
'priority': '#E74C3C' # Rojo para la categoría prioritaria
|
| 340 |
-
}
|
| 341 |
-
|
| 342 |
-
# Iconos para cada categoría
|
| 343 |
-
icons = {
|
| 344 |
-
'vocabulary': '📚',
|
| 345 |
-
'structure': '🏗️',
|
| 346 |
-
'cohesion': '🔄',
|
| 347 |
-
'clarity': '💡',
|
| 348 |
-
'priority': '⭐'
|
| 349 |
-
}
|
| 350 |
-
|
| 351 |
-
# Mapeo de dimensiones a funcionalidades de la aplicación
|
| 352 |
-
dimension_to_tool = {
|
| 353 |
-
'vocabulary': {'tool': 'Análisis Semántico', 'description': 'Examina el vocabulario y las relaciones entre conceptos en tu texto'},
|
| 354 |
-
'structure': {'tool': 'Análisis Morfosintáctico', 'description': 'Analiza la estructura gramatical y sintáctica de tus oraciones'},
|
| 355 |
-
'cohesion': {'tool': 'Análisis del Discurso', 'description': 'Evalúa la cohesión y coherencia entre diferentes partes de tu texto'},
|
| 356 |
-
'clarity': {'tool': 'Análisis Morfosintáctico', 'description': 'Mejora la claridad identificando la complejidad de tus oraciones'},
|
| 357 |
-
}
|
| 358 |
-
|
| 359 |
-
# Obtener traducciones para cada dimensión
|
| 360 |
-
dimension_names = {
|
| 361 |
-
'vocabulary': t.get('SITUATION_ANALYSIS', {}).get('vocabulary', "Vocabulario"),
|
| 362 |
-
'structure': t.get('SITUATION_ANALYSIS', {}).get('structure', "Estructura"),
|
| 363 |
-
'cohesion': t.get('SITUATION_ANALYSIS', {}).get('cohesion', "Cohesión"),
|
| 364 |
-
'clarity': t.get('SITUATION_ANALYSIS', {}).get('clarity', "Claridad"),
|
| 365 |
-
'priority': t.get('SITUATION_ANALYSIS', {}).get('priority', "Prioridad")
|
| 366 |
-
}
|
| 367 |
-
|
| 368 |
-
# Título de la sección prioritaria
|
| 369 |
-
priority_focus = t.get('SITUATION_ANALYSIS', {}).get('priority_focus', 'Área prioritaria para mejorar')
|
| 370 |
-
st.markdown(f"### {icons['priority']} {priority_focus}")
|
| 371 |
-
|
| 372 |
-
# Determinar área prioritaria (la que tiene menor puntuación)
|
| 373 |
-
priority_area = recommendations.get('priority', {}).get('area', 'vocabulary')
|
| 374 |
-
priority_title = dimension_names.get(priority_area, "Área prioritaria")
|
| 375 |
-
|
| 376 |
-
# Determinar el contenido para mostrar
|
| 377 |
-
priority_content = recommendations.get('priority', {}).get('tips', [])
|
| 378 |
-
if isinstance(priority_content, list):
|
| 379 |
-
priority_content = "<br>".join([f"• {tip}" for tip in priority_content])
|
| 380 |
-
|
| 381 |
-
# MODIFICACIÓN: Texto modificado para la recomendación prioritaria
|
| 382 |
-
with st.container():
|
| 383 |
-
st.markdown(
|
| 384 |
-
f"""
|
| 385 |
-
<div style="border:2px solid {colors['priority']}; border-radius:5px; padding:15px; margin-bottom:20px;">
|
| 386 |
-
<h4 style="color:{colors['priority']};">{priority_title}</h4>
|
| 387 |
-
<p>{priority_content}</p>
|
| 388 |
-
<p><strong>Recomendación:</strong> Despliega el asistente virtual (potenciado por Claude.AI) que se ubica en la parte superior izquierda, presiona la flecha del lado del logo.</p>
|
| 389 |
-
</div>
|
| 390 |
-
""",
|
| 391 |
-
unsafe_allow_html=True
|
| 392 |
-
)
|
| 393 |
-
|
| 394 |
-
# MODIFICACIÓN: Eliminado el botón para ir a la herramienta recomendada
|
| 395 |
-
|
| 396 |
-
# Crear dos columnas para las tarjetas de recomendaciones restantes
|
| 397 |
-
col1, col2 = st.columns(2)
|
| 398 |
-
|
| 399 |
-
# Distribuir las recomendaciones en las columnas
|
| 400 |
-
categories = ['vocabulary', 'structure', 'cohesion', 'clarity']
|
| 401 |
-
for i, category in enumerate(categories):
|
| 402 |
-
# Saltar si esta categoría ya es la prioritaria
|
| 403 |
-
if category == priority_area:
|
| 404 |
-
continue
|
| 405 |
-
|
| 406 |
-
# Obtener las recomendaciones para esta categoría
|
| 407 |
-
category_content = recommendations.get(category, [])
|
| 408 |
-
if isinstance(category_content, list):
|
| 409 |
-
category_content = "<br>".join([f"• {tip}" for tip in category_content])
|
| 410 |
-
|
| 411 |
-
category_title = dimension_names.get(category, category)
|
| 412 |
-
|
| 413 |
-
# Alternar entre columnas
|
| 414 |
-
with col1 if i % 2 == 0 else col2:
|
| 415 |
-
# MODIFICACIÓN: Tarjeta solo con el nombre de la funcionalidad, sin botón
|
| 416 |
-
st.markdown(
|
| 417 |
-
f"""
|
| 418 |
-
<div style="border:1px solid {colors[category]}; border-radius:5px; padding:10px; margin-bottom:15px;">
|
| 419 |
-
<h4 style="color:{colors[category]};">{icons[category]} {category_title}</h4>
|
| 420 |
-
<p>{category_content}</p>
|
| 421 |
-
</div>
|
| 422 |
-
""",
|
| 423 |
-
unsafe_allow_html=True
|
| 424 |
-
)
|
| 425 |
-
|
| 426 |
-
# MODIFICACIÓN: Eliminado el botón para ir a la herramienta específica
|
| 427 |
-
|
| 428 |
-
# Agregar una sección para recursos adicionales
|
| 429 |
-
st.markdown("---")
|
| 430 |
-
st.markdown("### 📖 Recursos adicionales")
|
| 431 |
-
|
| 432 |
-
with st.expander("Ver recursos de aprendizaje"):
|
| 433 |
-
st.markdown("""
|
| 434 |
-
### Recursos por área
|
| 435 |
-
|
| 436 |
-
#### Vocabulario
|
| 437 |
-
- **Diccionario de la Real Academia Española**: [www.rae.es](https://www.rae.es)
|
| 438 |
-
- **Fundación del Español Urgente**: [www.fundeu.es](https://www.fundeu.es)
|
| 439 |
-
|
| 440 |
-
#### Estructura
|
| 441 |
-
- **Manual de gramática**: [Gramática y ortografía para dummies](https://www.planetadelibros.com/libro-gramatica-y-ortografia-para-dummies/248265)
|
| 442 |
-
- **Ortografía de la RAE**: [Ortografía básica de la lengua española](https://www.rae.es/obras-academicas/ortografia/ortografia-basica-de-la-lengua-espanola)
|
| 443 |
-
|
| 444 |
-
#### Cohesión
|
| 445 |
-
- **Centro Virtual Cervantes**: [Diccionario de términos clave de ELE](https://cvc.cervantes.es/ensenanza/biblioteca_ele/diccio_ele/indice.htm)
|
| 446 |
-
- **Curso de cohesión textual**: [Centro de Escritura Javeriano](https://www2.javerianacali.edu.co/sites/ujc/files/normas_apa_revisada_y_actualizada_mayo_2019.pdf)
|
| 447 |
-
|
| 448 |
-
#### Claridad
|
| 449 |
-
- **Curso de escritura científica**: [Cómo escribir y publicar trabajos científicos](https://www.conacyt.gov.py/sites/default/files/upload_editores/u38/CONI-NOR-113.pdf)
|
| 450 |
-
- **Manual de estilo**: [Manual de estilo de la lengua española](https://www.planetadelibros.com/libro-manual-de-estilo-de-la-lengua-espanola/17811)
|
| 451 |
-
""")
|
| 452 |
-
|
| 453 |
-
# Boletines o actualizaciones del sistema
|
| 454 |
-
with st.expander("📬 Actualizaciones de AIdeaText"):
|
| 455 |
-
st.markdown("""
|
| 456 |
-
## Próximas actualizaciones
|
| 457 |
-
|
| 458 |
-
- **Nueva funcionalidad**: Análisis comparativo entre textos propios
|
| 459 |
-
- **Mejora**: Recomendaciones más detalladas y personalizadas
|
| 460 |
-
- **Próximamente**: Tutorial interactivo para mejorar la escritura
|
| 461 |
-
|
| 462 |
-
> Estamos trabajando continuamente para mejorar tus herramientas de escritura.
|
| 463 |
-
""")
|
|
|
|
| 10 |
# Importaciones locales
|
| 11 |
from translations import get_translations
|
| 12 |
|
| 13 |
+
from .claude_recommendations import display_personalized_recommendations
|
| 14 |
+
|
| 15 |
from .current_situation_analysis import (
|
| 16 |
analyze_text_dimensions,
|
| 17 |
analyze_clarity,
|
|
|
|
| 328 |
|
| 329 |
#####################################################
|
| 330 |
|
| 331 |
+
display_personalized_recommendations(
|
| 332 |
+
text=text_input,
|
| 333 |
+
metrics=st.session_state.current_metrics,
|
| 334 |
+
text_type=text_type,
|
| 335 |
+
lang_code=lang_code,
|
| 336 |
+
t=t
|
| 337 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|