AIdeaText commited on
Commit
4f8d08e
1 Parent(s): 3b70165

Update modules/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui.py +2 -11
modules/ui.py CHANGED
@@ -207,7 +207,6 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
207
  'repeated_words': "Palabras repetidas",
208
  'legend': "Leyenda: Categorías gramaticales",
209
  'arc_diagram': "Análisis sintáctico: Diagrama de arco",
210
- 'network_diagram': "Análisis sintáctico: Diagrama de red",
211
  'sentence': "Oración"
212
  },
213
  'en': {
@@ -218,7 +217,6 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
218
  'repeated_words': "Repeated words",
219
  'legend': "Legend: Grammatical categories",
220
  'arc_diagram': "Syntactic analysis: Arc diagram",
221
- 'network_diagram': "Syntactic analysis: Network diagram",
222
  'sentence': "Sentence"
223
  },
224
  'fr': {
@@ -229,7 +227,6 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
229
  'repeated_words': "Mots répétés",
230
  'legend': "Légende : Catégories grammaticales",
231
  'arc_diagram': "Analyse syntaxique : Diagramme en arc",
232
- 'network_diagram': "Analyse syntaxique : Diagramme de réseau",
233
  'sentence': "Phrase"
234
  }
235
  }
@@ -250,17 +247,14 @@ 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
- 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():
@@ -269,7 +263,6 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
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 = []
@@ -282,7 +275,6 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
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,
@@ -292,9 +284,8 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
292
  st.success("Análisis guardado correctamente.")
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):
 
207
  'repeated_words': "Palabras repetidas",
208
  'legend': "Leyenda: Categorías gramaticales",
209
  'arc_diagram': "Análisis sintáctico: Diagrama de arco",
 
210
  'sentence': "Oración"
211
  },
212
  'en': {
 
217
  'repeated_words': "Repeated words",
218
  'legend': "Legend: Grammatical categories",
219
  'arc_diagram': "Syntactic analysis: Arc diagram",
 
220
  'sentence': "Sentence"
221
  },
222
  'fr': {
 
227
  'repeated_words': "Mots répétés",
228
  'legend': "Légende : Catégories grammaticales",
229
  'arc_diagram': "Analyse syntaxique : Diagramme en arc",
 
230
  'sentence': "Phrase"
231
  }
232
  }
 
247
 
248
  if st.button(t['analyze_button'], key=f"analyze_button_{lang_code}"):
249
  if sentence_input:
 
250
  doc = nlp_models[lang_code](sentence_input)
251
 
 
252
  word_colors = get_repeated_words_colors(doc)
253
 
254
  with st.expander(t['repeated_words'], expanded=True):
255
  highlighted_text = highlight_repeated_words(doc, word_colors)
256
  st.markdown(highlighted_text, unsafe_allow_html=True)
257
 
 
258
  st.markdown(f"##### {t['legend']}")
259
  legend_html = "<div style='display: flex; flex-wrap: wrap;'>"
260
  for pos, color in POS_COLORS.items():
 
263
  legend_html += "</div>"
264
  st.markdown(legend_html, unsafe_allow_html=True)
265
 
 
266
  with st.expander(t['arc_diagram'], expanded=True):
267
  sentences = list(doc.sents)
268
  arc_diagrams = []
 
275
  st.write(html, unsafe_allow_html=True)
276
  arc_diagrams.append(html)
277
 
 
278
  if store_morphosyntax_result(
279
  st.session_state.username,
280
  sentence_input,
 
284
  st.success("Análisis guardado correctamente.")
285
  else:
286
  st.error("Hubo un problema al guardar el análisis. Por favor, inténtelo de nuevo.")
287
+ else:
288
+ st.warning("Por favor, ingrese un texto para analizar.")
 
289
 
290
  ###############################################################################################################
291
  def display_semantic_analysis_interface(nlp_models, lang_code):