Update modules/studentact/current_situation_analysis.py
Browse files
modules/studentact/current_situation_analysis.py
CHANGED
@@ -305,27 +305,23 @@ def analyze_cohesion(doc):
|
|
305 |
logger.error(f"Error en analyze_cohesion: {str(e)}")
|
306 |
return 0.0
|
307 |
|
308 |
-
|
309 |
-
|
310 |
def analyze_structure(doc):
|
311 |
-
"""Analiza la complejidad estructural"""
|
312 |
try:
|
313 |
if len(doc) == 0:
|
314 |
-
logger.warning("Documento vacío")
|
315 |
return 0.0
|
316 |
|
317 |
-
|
318 |
for token in doc:
|
319 |
if token.dep_ == 'ROOT':
|
320 |
-
|
321 |
-
|
322 |
|
323 |
-
if not
|
324 |
-
logger.warning("No se encontraron estructuras de dependencia")
|
325 |
return 0.0
|
326 |
|
327 |
-
|
328 |
-
|
329 |
except Exception as e:
|
330 |
logger.error(f"Error en analyze_structure: {str(e)}")
|
331 |
return 0.0
|
|
|
305 |
logger.error(f"Error en analyze_cohesion: {str(e)}")
|
306 |
return 0.0
|
307 |
|
308 |
+
#####################################################
|
|
|
309 |
def analyze_structure(doc):
|
|
|
310 |
try:
|
311 |
if len(doc) == 0:
|
|
|
312 |
return 0.0
|
313 |
|
314 |
+
structure_scores = []
|
315 |
for token in doc:
|
316 |
if token.dep_ == 'ROOT':
|
317 |
+
result = get_dependency_depths(token)
|
318 |
+
structure_scores.append(result['final_score'])
|
319 |
|
320 |
+
if not structure_scores:
|
|
|
321 |
return 0.0
|
322 |
|
323 |
+
return min(1.0, sum(structure_scores) / len(structure_scores))
|
324 |
+
|
325 |
except Exception as e:
|
326 |
logger.error(f"Error en analyze_structure: {str(e)}")
|
327 |
return 0.0
|