AIdeaText commited on
Commit
f90de2b
1 Parent(s): 0db7797

Update modules/morphosyntax/morphosyntax_interface.py

Browse files
modules/morphosyntax/morphosyntax_interface.py CHANGED
@@ -109,6 +109,8 @@ def display_morphosyntax_interface(lang_code, nlp_models, t):
109
  else:
110
  st.info(morpho_t.get('morpho_initial_message', 'Enter text to begin analysis'))
111
 
 
 
112
  def display_morphosyntax_results(result, lang_code, t):
113
  """
114
  Muestra los resultados del análisis morfosintáctico.
@@ -123,13 +125,12 @@ def display_morphosyntax_results(result, lang_code, t):
123
  if result is None:
124
  st.warning(morpho_t.get('no_results', 'No results available'))
125
  return
126
-
127
 
128
  doc = result['doc']
129
  advanced_analysis = result['advanced_analysis']
130
 
131
- # Mostrar leyenda (código existente)
132
- st.markdown(f"##### {t['legend']}")
133
  legend_html = "<div style='display: flex; flex-wrap: wrap;'>"
134
  for pos, color in POS_COLORS.items():
135
  if pos in POS_TRANSLATIONS[lang_code]:
@@ -137,21 +138,21 @@ def display_morphosyntax_results(result, lang_code, t):
137
  legend_html += "</div>"
138
  st.markdown(legend_html, unsafe_allow_html=True)
139
 
140
- # Mostrar análisis de palabras repetidas (código existente)
141
  word_colors = get_repeated_words_colors(doc)
142
- with st.expander(t['repeated_words'], expanded=True):
143
  highlighted_text = highlight_repeated_words(doc, word_colors)
144
  st.markdown(highlighted_text, unsafe_allow_html=True)
145
 
146
  # Mostrar estructura de oraciones
147
- with st.expander(t['sentence_structure'], expanded=True):
148
  for i, sent_analysis in enumerate(advanced_analysis['sentence_structure']):
149
  sentence_str = (
150
- f"**{t['sentence']} {i+1}** "
151
- f"{t['root']}: {sent_analysis['root']} ({sent_analysis['root_pos']}) -- "
152
- f"{t['subjects']}: {', '.join(sent_analysis['subjects'])} -- "
153
- f"{t['objects']}: {', '.join(sent_analysis['objects'])} -- "
154
- f"{t['verbs']}: {', '.join(sent_analysis['verbs'])}"
155
  )
156
  st.markdown(sentence_str)
157
 
 
109
  else:
110
  st.info(morpho_t.get('morpho_initial_message', 'Enter text to begin analysis'))
111
 
112
+
113
+ ############################################################################################################
114
  def display_morphosyntax_results(result, lang_code, t):
115
  """
116
  Muestra los resultados del análisis morfosintáctico.
 
125
  if result is None:
126
  st.warning(morpho_t.get('no_results', 'No results available'))
127
  return
 
128
 
129
  doc = result['doc']
130
  advanced_analysis = result['advanced_analysis']
131
 
132
+ # Mostrar leyenda
133
+ st.markdown(f"##### {morpho_t.get('legend', 'Legend: Grammatical categories')}")
134
  legend_html = "<div style='display: flex; flex-wrap: wrap;'>"
135
  for pos, color in POS_COLORS.items():
136
  if pos in POS_TRANSLATIONS[lang_code]:
 
138
  legend_html += "</div>"
139
  st.markdown(legend_html, unsafe_allow_html=True)
140
 
141
+ # Mostrar análisis de palabras repetidas
142
  word_colors = get_repeated_words_colors(doc)
143
+ with st.expander(morpho_t.get('repeated_words', 'Repeated words'), expanded=True):
144
  highlighted_text = highlight_repeated_words(doc, word_colors)
145
  st.markdown(highlighted_text, unsafe_allow_html=True)
146
 
147
  # Mostrar estructura de oraciones
148
+ with st.expander(morpho_t.get('sentence_structure', 'Sentence structure'), expanded=True):
149
  for i, sent_analysis in enumerate(advanced_analysis['sentence_structure']):
150
  sentence_str = (
151
+ f"**{morpho_t.get('sentence', 'Sentence')} {i+1}** "
152
+ f"{morpho_t.get('root', 'Root')}: {sent_analysis['root']} ({sent_analysis['root_pos']}) -- "
153
+ f"{morpho_t.get('subjects', 'Subjects')}: {', '.join(sent_analysis['subjects'])} -- "
154
+ f"{morpho_t.get('objects', 'Objects')}: {', '.join(sent_analysis['objects'])} -- "
155
+ f"{morpho_t.get('verbs', 'Verbs')}: {', '.join(sent_analysis['verbs'])}"
156
  )
157
  st.markdown(sentence_str)
158