Update modules/ui.py
Browse files- modules/ui.py +15 -6
modules/ui.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
import streamlit as st
|
4 |
from spacy import displacy
|
5 |
import re
|
|
|
6 |
import matplotlib.pyplot as plt
|
7 |
import matplotlib
|
8 |
matplotlib.use('Agg')
|
@@ -94,7 +95,11 @@ def display_student_progress(username):
|
|
94 |
fig, ax = plt.subplots(figsize=(10, 6))
|
95 |
categories = list(student_data['word_count'].keys())
|
96 |
counts = list(student_data['word_count'].values())
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
ax.set_xlabel('Categor铆a')
|
99 |
ax.set_ylabel('Conteo Total')
|
100 |
ax.set_title('Conteo de Palabras por Categor铆a Gramatical')
|
@@ -115,7 +120,7 @@ def display_student_progress(username):
|
|
115 |
if evolution_data:
|
116 |
fig, ax = plt.subplots(figsize=(10, 6))
|
117 |
for category, counts in evolution_data.items():
|
118 |
-
ax.plot(range(1, len(counts) + 1), counts, label=category)
|
119 |
ax.set_xlabel('N煤mero de Entrada')
|
120 |
ax.set_ylabel('Conteo de Palabras')
|
121 |
ax.set_title('Evoluci贸n del Conteo de Palabras por Categor铆a')
|
@@ -129,16 +134,20 @@ def display_student_progress(username):
|
|
129 |
for i, entry in enumerate(student_data['entries'][:5]):
|
130 |
with st.expander(f"Entrada {i+1} - {entry['timestamp']}"):
|
131 |
st.write(entry['text'])
|
132 |
-
if 'arc_diagrams' in
|
133 |
st.subheader("Diagrama de Arco")
|
134 |
-
st.write(
|
135 |
-
if '
|
136 |
st.subheader("Diagrama de Red")
|
137 |
-
st.image(
|
138 |
else:
|
139 |
st.warning("No se encontraron datos para este estudiante.")
|
140 |
st.info("Intenta realizar algunos an谩lisis de texto primero.")
|
141 |
|
|
|
|
|
|
|
|
|
142 |
##########################################################################
|
143 |
def display_text_analysis_interface(nlp_models, lang_code):
|
144 |
translations = {
|
|
|
3 |
import streamlit as st
|
4 |
from spacy import displacy
|
5 |
import re
|
6 |
+
from .morpho_analysis import POS_TRANSLATIONS # Aseg煤rate de que esta importaci贸n est茅 presente
|
7 |
import matplotlib.pyplot as plt
|
8 |
import matplotlib
|
9 |
matplotlib.use('Agg')
|
|
|
95 |
fig, ax = plt.subplots(figsize=(10, 6))
|
96 |
categories = list(student_data['word_count'].keys())
|
97 |
counts = list(student_data['word_count'].values())
|
98 |
+
|
99 |
+
# Traducir las categor铆as
|
100 |
+
translated_categories = [POS_TRANSLATIONS.get(cat, cat) for cat in categories]
|
101 |
+
|
102 |
+
ax.bar(translated_categories, counts)
|
103 |
ax.set_xlabel('Categor铆a')
|
104 |
ax.set_ylabel('Conteo Total')
|
105 |
ax.set_title('Conteo de Palabras por Categor铆a Gramatical')
|
|
|
120 |
if evolution_data:
|
121 |
fig, ax = plt.subplots(figsize=(10, 6))
|
122 |
for category, counts in evolution_data.items():
|
123 |
+
ax.plot(range(1, len(counts) + 1), counts, label=POS_TRANSLATIONS.get(category, category))
|
124 |
ax.set_xlabel('N煤mero de Entrada')
|
125 |
ax.set_ylabel('Conteo de Palabras')
|
126 |
ax.set_title('Evoluci贸n del Conteo de Palabras por Categor铆a')
|
|
|
134 |
for i, entry in enumerate(student_data['entries'][:5]):
|
135 |
with st.expander(f"Entrada {i+1} - {entry['timestamp']}"):
|
136 |
st.write(entry['text'])
|
137 |
+
if 'arc_diagrams' in entry and entry['arc_diagrams']:
|
138 |
st.subheader("Diagrama de Arco")
|
139 |
+
st.write(entry['arc_diagrams'][0], unsafe_allow_html=True)
|
140 |
+
if 'network_diagram' in entry and entry['network_diagram']:
|
141 |
st.subheader("Diagrama de Red")
|
142 |
+
st.image(entry['network_diagram'])
|
143 |
else:
|
144 |
st.warning("No se encontraron datos para este estudiante.")
|
145 |
st.info("Intenta realizar algunos an谩lisis de texto primero.")
|
146 |
|
147 |
+
# Agregar informaci贸n de depuraci贸n
|
148 |
+
st.subheader("Informaci贸n de Depuraci贸n")
|
149 |
+
st.json(student_data)
|
150 |
+
|
151 |
##########################################################################
|
152 |
def display_text_analysis_interface(nlp_models, lang_code):
|
153 |
translations = {
|