Update modules/morphosyntax/morphosyntax_interface.py
Browse files
modules/morphosyntax/morphosyntax_interface.py
CHANGED
@@ -83,26 +83,26 @@ def display_morphosyntax_interface(lang_code, nlp_models, t):
|
|
83 |
lang_code,
|
84 |
morpho_t # Pasar morpho_t en lugar de t
|
85 |
)
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
|
107 |
|
108 |
# Mostrar resultados previos si existen
|
|
|
83 |
lang_code,
|
84 |
morpho_t # Pasar morpho_t en lugar de t
|
85 |
)
|
86 |
+
|
87 |
+
try:
|
88 |
+
if current_input:
|
89 |
+
# Extraer los diagramas de arco del análisis
|
90 |
+
doc = nlp_models[lang_code](current_input)
|
91 |
+
advanced_analysis = perform_advanced_morphosyntactic_analysis(current_input, nlp_models[lang_code])
|
92 |
+
|
93 |
+
# Guardar el análisis
|
94 |
+
if store_student_morphosyntax_result(
|
95 |
+
username=st.session_state.username,
|
96 |
+
text=current_input,
|
97 |
+
arc_diagrams=advanced_analysis['arc_diagram']
|
98 |
+
):
|
99 |
+
st.success(morpho_t.get('success_message', 'Analysis saved successfully'))
|
100 |
+
else:
|
101 |
+
st.error(morpho_t.get('error_message', 'Error saving analysis'))
|
102 |
+
except Exception as e:
|
103 |
+
st.error(morpho_t.get('error_processing', f'Error processing text: {str(e)}'))
|
104 |
+
else:
|
105 |
+
st.warning(morpho_t.get('warning_message', 'Please enter a text to analyze'))
|
106 |
|
107 |
|
108 |
# Mostrar resultados previos si existen
|