AIdeaText commited on
Commit
28786d1
·
verified ·
1 Parent(s): 4cb0838

Update modules/morphosyntax/morphosyntax_interface.py

Browse files
modules/morphosyntax/morphosyntax_interface.py CHANGED
@@ -123,14 +123,13 @@ def display_morphosyntax_results(result, lang_code, t):
123
  morpho_t = t.get('MORPHOSYNTACTIC', {})
124
 
125
  if result is None:
126
- st.warning(t['no_results']) # Añade esta traducción a tu diccionario
127
  return
128
 
129
  doc = result['doc']
130
  advanced_analysis = result['advanced_analysis']
131
 
132
- # Mostrar leyenda (código existente)
133
- #st.markdown(f"##### {t['legend']}")
134
  st.markdown(f"##### {morpho_t.get('legend', 'Legend: Grammatical categories')}")
135
  legend_html = "<div style='display: flex; flex-wrap: wrap;'>"
136
  for pos, color in POS_COLORS.items():
@@ -139,7 +138,7 @@ def display_morphosyntax_results(result, lang_code, t):
139
  legend_html += "</div>"
140
  st.markdown(legend_html, unsafe_allow_html=True)
141
 
142
- # Mostrar análisis de palabras repetidas (código existente)
143
  word_colors = get_repeated_words_colors(doc)
144
  with st.expander(morpho_t.get('repeated_words', 'Repeated words'), expanded=True):
145
  highlighted_text = highlight_repeated_words(doc, word_colors)
@@ -149,11 +148,11 @@ def display_morphosyntax_results(result, lang_code, t):
149
  with st.expander(morpho_t.get('sentence_structure', 'Sentence structure'), expanded=True):
150
  for i, sent_analysis in enumerate(advanced_analysis['sentence_structure']):
151
  sentence_str = (
152
- f"**{t['sentence']} {i+1}** "
153
- f"{t['root']}: {sent_analysis['root']} ({sent_analysis['root_pos']}) -- "
154
- f"{t['subjects']}: {', '.join(sent_analysis['subjects'])} -- "
155
- f"{t['objects']}: {', '.join(sent_analysis['objects'])} -- "
156
- f"{t['verbs']}: {', '.join(sent_analysis['verbs'])}"
157
  )
158
  st.markdown(sentence_str)
159
 
 
123
  morpho_t = t.get('MORPHOSYNTACTIC', {})
124
 
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():
 
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)
 
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}** " # Aquí está el cambio
152
+ f"{morpho_t.get('root', 'Root')}: {sent_analysis['root']} ({sent_analysis['root_pos']}) -- " # Y aquí
153
+ f"{morpho_t.get('subjects', 'Subjects')}: {', '.join(sent_analysis['subjects'])} -- " # Y aquí
154
+ f"{morpho_t.get('objects', 'Objects')}: {', '.join(sent_analysis['objects'])} -- " # Y aquí
155
+ f"{morpho_t.get('verbs', 'Verbs')}: {', '.join(sent_analysis['verbs'])}" # Y aquí
156
  )
157
  st.markdown(sentence_str)
158