Update modules/database.py
Browse files- modules/database.py +26 -2
modules/database.py
CHANGED
@@ -152,7 +152,7 @@ def get_student_data(username):
|
|
152 |
|
153 |
#######################################################################################################
|
154 |
|
155 |
-
def
|
156 |
if analysis_collection is None:
|
157 |
logger.error("La conexi贸n a MongoDB no est谩 inicializada")
|
158 |
return False
|
@@ -182,4 +182,28 @@ def store_analysis_result(username, text, repeated_words, arc_diagrams, network_
|
|
182 |
return True
|
183 |
except Exception as e:
|
184 |
logger.error(f"Error al guardar el an谩lisis para el usuario {username}: {str(e)}")
|
185 |
-
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
#######################################################################################################
|
154 |
|
155 |
+
def store_morphosyntax_result(username, text, repeated_words, arc_diagrams):
|
156 |
if analysis_collection is None:
|
157 |
logger.error("La conexi贸n a MongoDB no est谩 inicializada")
|
158 |
return False
|
|
|
182 |
return True
|
183 |
except Exception as e:
|
184 |
logger.error(f"Error al guardar el an谩lisis para el usuario {username}: {str(e)}")
|
185 |
+
return False
|
186 |
+
|
187 |
+
################################################################################################################
|
188 |
+
def store_semantic_result(username, text, network_diagram):
|
189 |
+
try:
|
190 |
+
analysis_document = {
|
191 |
+
'username': username,
|
192 |
+
'timestamp': datetime.utcnow(),
|
193 |
+
'text': text,
|
194 |
+
'network_diagram': network_diagram,
|
195 |
+
'analysis_type': 'semantic'
|
196 |
+
}
|
197 |
+
|
198 |
+
result = analysis_collection.insert_one(analysis_document)
|
199 |
+
|
200 |
+
logger.info(f"An谩lisis sem谩ntico guardado con ID: {result.inserted_id} para el usuario: {username}")
|
201 |
+
return True
|
202 |
+
except Exception as e:
|
203 |
+
logger.error(f"Error al guardar el an谩lisis sem谩ntico para el usuario {username}: {str(e)}")
|
204 |
+
return False
|
205 |
+
|
206 |
+
###############################################################################################################
|
207 |
+
def store_discourse_semantic_result(username, text, discourse_analysis):
|
208 |
+
# Implementaci贸n similar a las anteriores
|
209 |
+
pass
|