Spaces:
Sleeping
Sleeping
Update modules/semantic/semantic_process.py
Browse files
modules/semantic/semantic_process.py
CHANGED
@@ -15,12 +15,13 @@ from ..database.semantic_mongo_db import store_student_semantic_result
|
|
15 |
|
16 |
logger = logging.getLogger(__name__)
|
17 |
|
|
|
18 |
def process_semantic_input(text_content, lang_code, nlp_models, semantic_t):
|
19 |
"""
|
20 |
Procesa el texto ingresado para realizar el análisis semántico.
|
21 |
"""
|
22 |
try:
|
23 |
-
logger.info(f"Iniciando análisis semántico para texto de {len(
|
24 |
|
25 |
# Realizar el análisis semántico
|
26 |
nlp = nlp_models[lang_code]
|
@@ -44,7 +45,7 @@ def process_semantic_input(text_content, lang_code, nlp_models, semantic_t):
|
|
44 |
try:
|
45 |
store_result = store_student_semantic_result(
|
46 |
st.session_state.username,
|
47 |
-
text
|
48 |
analysis_result
|
49 |
)
|
50 |
if not store_result:
|
@@ -55,7 +56,7 @@ def process_semantic_input(text_content, lang_code, nlp_models, semantic_t):
|
|
55 |
# Devolver el resultado incluso si falla el guardado
|
56 |
return {
|
57 |
'success': True,
|
58 |
-
'message':
|
59 |
'analysis': {
|
60 |
'key_concepts': analysis_result['key_concepts'],
|
61 |
'concept_graph': analysis_result['concept_graph']
|
@@ -69,6 +70,7 @@ def process_semantic_input(text_content, lang_code, nlp_models, semantic_t):
|
|
69 |
'message': str(e),
|
70 |
'analysis': None
|
71 |
}
|
|
|
72 |
########################################################################################
|
73 |
def format_semantic_results(analysis_result, t):
|
74 |
"""
|
|
|
15 |
|
16 |
logger = logging.getLogger(__name__)
|
17 |
|
18 |
+
#############################################################################
|
19 |
def process_semantic_input(text_content, lang_code, nlp_models, semantic_t):
|
20 |
"""
|
21 |
Procesa el texto ingresado para realizar el análisis semántico.
|
22 |
"""
|
23 |
try:
|
24 |
+
logger.info(f"Iniciando análisis semántico para texto de {len(text_content)} caracteres")
|
25 |
|
26 |
# Realizar el análisis semántico
|
27 |
nlp = nlp_models[lang_code]
|
|
|
45 |
try:
|
46 |
store_result = store_student_semantic_result(
|
47 |
st.session_state.username,
|
48 |
+
text_content, # Cambiado de text a text_content
|
49 |
analysis_result
|
50 |
)
|
51 |
if not store_result:
|
|
|
56 |
# Devolver el resultado incluso si falla el guardado
|
57 |
return {
|
58 |
'success': True,
|
59 |
+
'message': semantic_t.get('success_message', 'Analysis completed successfully'), # Cambiado de t a semantic_t
|
60 |
'analysis': {
|
61 |
'key_concepts': analysis_result['key_concepts'],
|
62 |
'concept_graph': analysis_result['concept_graph']
|
|
|
70 |
'message': str(e),
|
71 |
'analysis': None
|
72 |
}
|
73 |
+
|
74 |
########################################################################################
|
75 |
def format_semantic_results(analysis_result, t):
|
76 |
"""
|