AIdeaText commited on
Commit
d3861be
·
verified ·
1 Parent(s): 96dcb3b

Update modules/morphosyntax/morphosyntax_interface.py

Browse files
modules/morphosyntax/morphosyntax_interface.py CHANGED
@@ -23,23 +23,22 @@ def display_morphosyntax_interface(lang_code, nlp_models, t):
23
  nlp_models: Modelos de spaCy cargados
24
  t: Diccionario de traducciones
25
  """
26
- #st.title(t['morphosyntax_title'])
27
 
28
  input_key = f"morphosyntax_input_{lang_code}"
29
-
30
  if input_key not in st.session_state:
31
  st.session_state[input_key] = ""
32
 
33
  sentence_input = st.text_area(
34
- t['morphosyntax_input_label'],
35
  height=150,
36
- placeholder=t['morphosyntax_placeholder'],
37
  value=st.session_state[input_key],
38
  key=f"text_area_{lang_code}",
39
  on_change=lambda: setattr(st.session_state, input_key, st.session_state[f"text_area_{lang_code}"])
40
  )
41
 
42
- if st.button(t['morphosyntax_analyze_button'], key=f"analyze_button_{lang_code}"):
43
  current_input = st.session_state[input_key]
44
  if current_input:
45
  doc = nlp_models[lang_code](current_input)
@@ -66,16 +65,16 @@ def display_morphosyntax_interface(lang_code, nlp_models, t):
66
  advanced_analysis['morphological_analysis'],
67
  advanced_analysis['sentence_structure']
68
  ):
69
- st.success(t['morphosyntax_success_message'])
70
  else:
71
- st.error(t['morphosyntax_error_message'])
72
  else:
73
- st.warning(t['morphosyntax_warning_message'])
74
  elif 'morphosyntax_result' in st.session_state and st.session_state.morphosyntax_result is not None:
75
  # Si hay un resultado guardado, mostrarlo
76
  display_morphosyntax_results(st.session_state.morphosyntax_result, lang_code, t)
77
  else:
78
- st.info(t['morphosyntax_initial_message'])
79
 
80
 
81
  '''
 
23
  nlp_models: Modelos de spaCy cargados
24
  t: Diccionario de traducciones
25
  """
26
+ st.title(t['title'])
27
 
28
  input_key = f"morphosyntax_input_{lang_code}"
 
29
  if input_key not in st.session_state:
30
  st.session_state[input_key] = ""
31
 
32
  sentence_input = st.text_area(
33
+ t['input_label'],
34
  height=150,
35
+ placeholder=t['input_placeholder'],
36
  value=st.session_state[input_key],
37
  key=f"text_area_{lang_code}",
38
  on_change=lambda: setattr(st.session_state, input_key, st.session_state[f"text_area_{lang_code}"])
39
  )
40
 
41
+ if st.button(t['analyze_button'], key=f"analyze_button_{lang_code}"):
42
  current_input = st.session_state[input_key]
43
  if current_input:
44
  doc = nlp_models[lang_code](current_input)
 
65
  advanced_analysis['morphological_analysis'],
66
  advanced_analysis['sentence_structure']
67
  ):
68
+ st.success(t['success_message'])
69
  else:
70
+ st.error(t['error_message'])
71
  else:
72
+ st.warning(t['warning_message'])
73
  elif 'morphosyntax_result' in st.session_state and st.session_state.morphosyntax_result is not None:
74
  # Si hay un resultado guardado, mostrarlo
75
  display_morphosyntax_results(st.session_state.morphosyntax_result, lang_code, t)
76
  else:
77
+ st.info(t['initial_message'])
78
 
79
 
80
  '''