Spaces:
Sleeping
Sleeping
Update modules/semantic/semantic_process.py
Browse files
modules/semantic/semantic_process.py
CHANGED
@@ -5,16 +5,22 @@ import io
|
|
5 |
import base64
|
6 |
import logging
|
7 |
|
|
|
8 |
from ..text_analysis.semantic_analysis import (
|
9 |
perform_semantic_analysis,
|
10 |
identify_key_concepts,
|
11 |
create_concept_graph,
|
12 |
visualize_concept_graph
|
13 |
)
|
|
|
|
|
14 |
from ..database.semantic_mongo_db import store_student_semantic_result
|
15 |
|
|
|
16 |
logger = logging.getLogger(__name__)
|
17 |
|
|
|
|
|
18 |
def process_semantic_input(text, lang_code, nlp_models, t, semantic_t):
|
19 |
"""
|
20 |
Procesa el texto ingresado para realizar el an谩lisis sem谩ntico.
|
@@ -56,7 +62,7 @@ def process_semantic_input(text, lang_code, nlp_models, t, semantic_t):
|
|
56 |
# Devolver el resultado incluso si falla el guardado
|
57 |
return {
|
58 |
'success': True,
|
59 |
-
'message':
|
60 |
'analysis': {
|
61 |
'key_concepts': analysis_result['key_concepts'],
|
62 |
'concept_graph': analysis_result['concept_graph']
|
@@ -71,6 +77,7 @@ def process_semantic_input(text, lang_code, nlp_models, t, semantic_t):
|
|
71 |
'analysis': None
|
72 |
}
|
73 |
|
|
|
74 |
def format_semantic_results(analysis_result, t):
|
75 |
"""
|
76 |
Formatea los resultados del an谩lisis para su visualizaci贸n.
|
|
|
5 |
import base64
|
6 |
import logging
|
7 |
|
8 |
+
##################################
|
9 |
from ..text_analysis.semantic_analysis import (
|
10 |
perform_semantic_analysis,
|
11 |
identify_key_concepts,
|
12 |
create_concept_graph,
|
13 |
visualize_concept_graph
|
14 |
)
|
15 |
+
|
16 |
+
####################################
|
17 |
from ..database.semantic_mongo_db import store_student_semantic_result
|
18 |
|
19 |
+
#############################################
|
20 |
logger = logging.getLogger(__name__)
|
21 |
|
22 |
+
|
23 |
+
#######################################################################
|
24 |
def process_semantic_input(text, lang_code, nlp_models, t, semantic_t):
|
25 |
"""
|
26 |
Procesa el texto ingresado para realizar el an谩lisis sem谩ntico.
|
|
|
62 |
# Devolver el resultado incluso si falla el guardado
|
63 |
return {
|
64 |
'success': True,
|
65 |
+
'message': semantic_t.get('success_message', 'Analysis completed successfully'),
|
66 |
'analysis': {
|
67 |
'key_concepts': analysis_result['key_concepts'],
|
68 |
'concept_graph': analysis_result['concept_graph']
|
|
|
77 |
'analysis': None
|
78 |
}
|
79 |
|
80 |
+
##########################################################################
|
81 |
def format_semantic_results(analysis_result, t):
|
82 |
"""
|
83 |
Formatea los resultados del an谩lisis para su visualizaci贸n.
|