Update modules/morphosyntax/morphosyntax_interface.py
Browse files
modules/morphosyntax/morphosyntax_interface.py
CHANGED
@@ -123,16 +123,16 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
123 |
|
124 |
# Textarea de texto base
|
125 |
arc_state["base_text"] = st.text_area(
|
126 |
-
|
127 |
value=arc_state["base_text"],
|
128 |
key="base_text_input",
|
129 |
height=150
|
130 |
)
|
131 |
|
132 |
# Bot贸n para analizar texto base
|
133 |
-
if st.button(morpho_t.get('
|
134 |
if not arc_state["base_text"].strip():
|
135 |
-
st.warning(morpho_t.get('warn_enter_text', "Ingrese un texto para
|
136 |
else:
|
137 |
try:
|
138 |
# Procesar con spaCy
|
@@ -156,11 +156,11 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
156 |
st.success(saved_msg.format(base_id=base_id))
|
157 |
|
158 |
except Exception as exc:
|
159 |
-
st.error(morpho_t.get('
|
160 |
logger.error(f"Error en an谩lisis base: {str(exc)}")
|
161 |
|
162 |
# Bot贸n para iniciar nuevo an谩lisis
|
163 |
-
if st.button(morpho_t.get('
|
164 |
# Si fuera necesario recargar la app por completo:
|
165 |
# st.experimental_rerun()
|
166 |
reset_arc_analysis_state()
|
@@ -168,36 +168,36 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
168 |
# Mostrar diagrama base
|
169 |
if arc_state["base_diagram"]:
|
170 |
st.markdown("<hr class='divider'>", unsafe_allow_html=True)
|
171 |
-
st.markdown(f"#### {morpho_t.get('
|
172 |
st.write(arc_state["base_diagram"], unsafe_allow_html=True)
|
173 |
else:
|
174 |
if arc_state["base_text"].strip():
|
175 |
# Solo mostrar si ya hay texto base pero no se ha procesado
|
176 |
-
st.info(morpho_t.get('
|
177 |
|
178 |
# ================== PESTA脩A 2: Iteraciones ==========================
|
179 |
with tabs[1]:
|
180 |
-
st.subheader(morpho_t.get('
|
181 |
|
182 |
# Verificar que exista un texto base
|
183 |
if not arc_state["base_id"]:
|
184 |
st.info(morpho_t.get('info_first_analyze_base',
|
185 |
-
"
|
186 |
return
|
187 |
|
188 |
# --- 1) Mostrar SIEMPRE el diagrama base arriba ---
|
189 |
-
st.markdown(f"#### {morpho_t.get('arc_diagram_base_label', 'Diagrama de
|
190 |
if arc_state["base_diagram"]:
|
191 |
st.write(arc_state["base_diagram"], unsafe_allow_html=True)
|
192 |
else:
|
193 |
-
st.info(morpho_t.get('
|
194 |
|
195 |
# --- 2) Caja de texto para la iteraci贸n ---
|
196 |
st.markdown("<hr class='divider'>", unsafe_allow_html=True)
|
197 |
-
st.subheader(morpho_t.get('iteration_text_subheader', "
|
198 |
|
199 |
arc_state["iteration_text"] = st.text_area(
|
200 |
-
morpho_t.get('input_iteration_text', "
|
201 |
value=arc_state["iteration_text"],
|
202 |
height=150
|
203 |
)
|
@@ -205,7 +205,7 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
205 |
# Bot贸n para analizar iteraci贸n
|
206 |
if st.button(morpho_t.get('btn_analyze_iteration', "Analizar Cambios"), key="btn_analyze_iteration"):
|
207 |
if not arc_state["iteration_text"].strip():
|
208 |
-
st.warning(morpho_t.get('warn_enter_iteration_text', "
|
209 |
else:
|
210 |
try:
|
211 |
# Procesar con spaCy
|
@@ -226,11 +226,11 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
226 |
arc_diagrams=analysis_iter["arc_diagrams"]
|
227 |
)
|
228 |
if iteration_id:
|
229 |
-
saved_iter_msg = morpho_t.get('iteration_saved', "
|
230 |
st.success(saved_iter_msg.format(iteration_id=iteration_id))
|
231 |
|
232 |
except Exception as exc:
|
233 |
-
st.error(morpho_t.get('error_iteration', "Error procesando
|
234 |
logger.error(f"Error en iteraci贸n: {str(exc)}")
|
235 |
|
236 |
# --- 3) Mostrar diagrama de iteraci贸n debajo ---
|
|
|
123 |
|
124 |
# Textarea de texto base
|
125 |
arc_state["base_text"] = st.text_area(
|
126 |
+
morpho_t.get('input_baseline_text', "Ingresa el primer texto para analizarlo"),
|
127 |
value=arc_state["base_text"],
|
128 |
key="base_text_input",
|
129 |
height=150
|
130 |
)
|
131 |
|
132 |
# Bot贸n para analizar texto base
|
133 |
+
if st.button(morpho_t.get('btn_analyze_baseline', "Analizar la primera versi贸n de tu texto"), key="btn_analyze_base"):
|
134 |
if not arc_state["base_text"].strip():
|
135 |
+
st.warning(morpho_t.get('warn_enter_text', "Ingrese un texto nuevo para analizarlo."))
|
136 |
else:
|
137 |
try:
|
138 |
# Procesar con spaCy
|
|
|
156 |
st.success(saved_msg.format(base_id=base_id))
|
157 |
|
158 |
except Exception as exc:
|
159 |
+
st.error(morpho_t.get('error_processing_baseline', "Error al procesar el texto inicial"))
|
160 |
logger.error(f"Error en an谩lisis base: {str(exc)}")
|
161 |
|
162 |
# Bot贸n para iniciar nuevo an谩lisis
|
163 |
+
if st.button(morpho_t.get('btn_new_morpho_analysis', "Nuevo an谩lisis morfosint谩tico"), key="btn_reset_base"):
|
164 |
# Si fuera necesario recargar la app por completo:
|
165 |
# st.experimental_rerun()
|
166 |
reset_arc_analysis_state()
|
|
|
168 |
# Mostrar diagrama base
|
169 |
if arc_state["base_diagram"]:
|
170 |
st.markdown("<hr class='divider'>", unsafe_allow_html=True)
|
171 |
+
st.markdown(f"#### {morpho_t.get('arc_diagram_baseline_label', 'Diagrama de arco del texto inicial')}")
|
172 |
st.write(arc_state["base_diagram"], unsafe_allow_html=True)
|
173 |
else:
|
174 |
if arc_state["base_text"].strip():
|
175 |
# Solo mostrar si ya hay texto base pero no se ha procesado
|
176 |
+
st.info(morpho_t.get('baseline_diagram_not_available', "Diagrama de arco del texto inicial no disponible."))
|
177 |
|
178 |
# ================== PESTA脩A 2: Iteraciones ==========================
|
179 |
with tabs[1]:
|
180 |
+
#st.subheader(morpho_t.get('iteration_text_subheader', "Nueva versi贸n del texto inicial"))
|
181 |
|
182 |
# Verificar que exista un texto base
|
183 |
if not arc_state["base_id"]:
|
184 |
st.info(morpho_t.get('info_first_analyze_base',
|
185 |
+
"Verifica la existencia de un texto anterior."))
|
186 |
return
|
187 |
|
188 |
# --- 1) Mostrar SIEMPRE el diagrama base arriba ---
|
189 |
+
st.markdown(f"#### {morpho_t.get('arc_diagram_base_label', 'Diagrama de arco del texto inicial')}")
|
190 |
if arc_state["base_diagram"]:
|
191 |
st.write(arc_state["base_diagram"], unsafe_allow_html=True)
|
192 |
else:
|
193 |
+
st.info(morpho_t.get('baseline_diagram_not_available', "Diagrama de arco del texto inicial no disponible."))
|
194 |
|
195 |
# --- 2) Caja de texto para la iteraci贸n ---
|
196 |
st.markdown("<hr class='divider'>", unsafe_allow_html=True)
|
197 |
+
#st.subheader(morpho_t.get('iteration_text_subheader', "Ingresa una nueva versi贸n del texto inicial y compara los arcos de ambos textos"))
|
198 |
|
199 |
arc_state["iteration_text"] = st.text_area(
|
200 |
+
morpho_t.get('input_iteration_text', "Ingresa una nueva versi贸n del texto inicial y compara los arcos de ambos textos"),
|
201 |
value=arc_state["iteration_text"],
|
202 |
height=150
|
203 |
)
|
|
|
205 |
# Bot贸n para analizar iteraci贸n
|
206 |
if st.button(morpho_t.get('btn_analyze_iteration', "Analizar Cambios"), key="btn_analyze_iteration"):
|
207 |
if not arc_state["iteration_text"].strip():
|
208 |
+
st.warning(morpho_t.get('warn_enter_iteration_text', "Ingresa una nueva versi贸n del texto inicial y compara los arcos de ambos textos."))
|
209 |
else:
|
210 |
try:
|
211 |
# Procesar con spaCy
|
|
|
226 |
arc_diagrams=analysis_iter["arc_diagrams"]
|
227 |
)
|
228 |
if iteration_id:
|
229 |
+
saved_iter_msg = morpho_t.get('iteration_saved', "Cambios guardados correctamente. ID: {iteration_id}")
|
230 |
st.success(saved_iter_msg.format(iteration_id=iteration_id))
|
231 |
|
232 |
except Exception as exc:
|
233 |
+
st.error(morpho_t.get('error_iteration', "Error procesando los nuevos cambios"))
|
234 |
logger.error(f"Error en iteraci贸n: {str(exc)}")
|
235 |
|
236 |
# --- 3) Mostrar diagrama de iteraci贸n debajo ---
|