AIdeaText commited on
Commit
4a52be9
·
verified ·
1 Parent(s): 9a78189

Update modules/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui.py +13 -5
modules/ui.py CHANGED
@@ -250,13 +250,17 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
250
 
251
  if st.button(t['analyze_button'], key=f"analyze_button_{lang_code}"):
252
  if sentence_input:
 
253
  doc = nlp_models[lang_code](sentence_input)
254
-
 
 
 
255
  with st.expander(t['repeated_words'], expanded=True):
256
- word_colors = get_repeated_words_colors(doc)
257
  highlighted_text = highlight_repeated_words(doc, word_colors)
258
  st.markdown(highlighted_text, unsafe_allow_html=True)
259
-
 
260
  st.markdown(f"##### {t['legend']}")
261
  legend_html = "<div style='display: flex; flex-wrap: wrap;'>"
262
  for pos, color in POS_COLORS.items():
@@ -264,7 +268,8 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
264
  legend_html += f"<div style='margin-right: 10px;'><span style='background-color: {color}; padding: 2px 5px;'>{POS_TRANSLATIONS[pos]}</span></div>"
265
  legend_html += "</div>"
266
  st.markdown(legend_html, unsafe_allow_html=True)
267
-
 
268
  with st.expander(t['arc_diagram'], expanded=True):
269
  sentences = list(doc.sents)
270
  arc_diagrams = []
@@ -276,7 +281,8 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
276
  html = re.sub(r'<g [^>]*transform="translate\((\d+),(\d+)\)"', lambda m: f'<g transform="translate({m.group(1)},50)"', html)
277
  st.write(html, unsafe_allow_html=True)
278
  arc_diagrams.append(html)
279
-
 
280
  if store_morphosyntax_result(
281
  st.session_state.username,
282
  sentence_input,
@@ -287,6 +293,8 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
287
  else:
288
  st.error("Hubo un problema al guardar el análisis. Por favor, inténtelo de nuevo.")
289
  st.error(f"Falló el guardado del análisis. Username: {st.session_state.username}")
 
 
290
 
291
  ###############################################################################################################
292
  def display_semantic_analysis_interface(nlp_models, lang_code):
 
250
 
251
  if st.button(t['analyze_button'], key=f"analyze_button_{lang_code}"):
252
  if sentence_input:
253
+ st.write(f"Procesando texto en {lang_code}")
254
  doc = nlp_models[lang_code](sentence_input)
255
+
256
+ st.write("Generando análisis de palabras repetidas")
257
+ word_colors = get_repeated_words_colors(doc)
258
+
259
  with st.expander(t['repeated_words'], expanded=True):
 
260
  highlighted_text = highlight_repeated_words(doc, word_colors)
261
  st.markdown(highlighted_text, unsafe_allow_html=True)
262
+
263
+ st.write("Generando leyenda de categorías gramaticales")
264
  st.markdown(f"##### {t['legend']}")
265
  legend_html = "<div style='display: flex; flex-wrap: wrap;'>"
266
  for pos, color in POS_COLORS.items():
 
268
  legend_html += f"<div style='margin-right: 10px;'><span style='background-color: {color}; padding: 2px 5px;'>{POS_TRANSLATIONS[pos]}</span></div>"
269
  legend_html += "</div>"
270
  st.markdown(legend_html, unsafe_allow_html=True)
271
+
272
+ st.write("Generando diagramas de arco")
273
  with st.expander(t['arc_diagram'], expanded=True):
274
  sentences = list(doc.sents)
275
  arc_diagrams = []
 
281
  html = re.sub(r'<g [^>]*transform="translate\((\d+),(\d+)\)"', lambda m: f'<g transform="translate({m.group(1)},50)"', html)
282
  st.write(html, unsafe_allow_html=True)
283
  arc_diagrams.append(html)
284
+
285
+ st.write("Guardando resultados en la base de datos")
286
  if store_morphosyntax_result(
287
  st.session_state.username,
288
  sentence_input,
 
293
  else:
294
  st.error("Hubo un problema al guardar el análisis. Por favor, inténtelo de nuevo.")
295
  st.error(f"Falló el guardado del análisis. Username: {st.session_state.username}")
296
+
297
+ st.write("Análisis morfosintáctico completado")
298
 
299
  ###############################################################################################################
300
  def display_semantic_analysis_interface(nlp_models, lang_code):