AIdeaText commited on
Commit
bcf68d2
1 Parent(s): 8e198cd

Update modules/database.py

Browse files
Files changed (1) hide show
  1. modules/database.py +26 -2
modules/database.py CHANGED
@@ -152,7 +152,7 @@ def get_student_data(username):
152
 
153
  #######################################################################################################
154
 
155
- def store_analysis_result(username, text, repeated_words, arc_diagrams, network_diagram):
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