Update modules/__init__.py
Browse files- modules/__init__.py +133 -82
modules/__init__.py
CHANGED
|
@@ -1,85 +1,136 @@
|
|
| 1 |
# modules/__init__.py
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
'login_form',
|
| 64 |
-
'register_form',
|
| 65 |
-
'user_page',
|
| 66 |
-
'admin_page', # A帽ade esta l铆nea
|
| 67 |
-
'display_morphosyntax_analysis_interface',
|
| 68 |
-
'display_semantic_analysis_interface',
|
| 69 |
-
'display_discourse_analysis_interface',
|
| 70 |
-
'display_chatbot_interface',
|
| 71 |
-
'display_student_progress',
|
| 72 |
-
'get_repeated_words_colors',
|
| 73 |
-
'highlight_repeated_words',
|
| 74 |
-
'POS_COLORS',
|
| 75 |
-
'POS_TRANSLATIONS',
|
| 76 |
-
'visualize_semantic_relations',
|
| 77 |
-
'perform_semantic_analysis',
|
| 78 |
-
'create_semantic_graph',
|
| 79 |
-
'perform_discourse_analysis',
|
| 80 |
-
'compare_semantic_analysis',
|
| 81 |
-
'load_spacy_models',
|
| 82 |
-
'initialize_chatbot',
|
| 83 |
-
'get_chatbot_response',
|
| 84 |
-
'ClaudeAPIChat'
|
| 85 |
-
]
|
|
|
|
| 1 |
# modules/__init__.py
|
| 2 |
|
| 3 |
+
# modules/__init__.py
|
| 4 |
+
|
| 5 |
+
def load_auth_functions():
|
| 6 |
+
from modules.auth.auth import authenticate_user, register_user
|
| 7 |
+
return {
|
| 8 |
+
'authenticate_user': authenticate_user,
|
| 9 |
+
'register_user': register_user
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
def load_database_function():
|
| 13 |
+
from modules.database.database import (
|
| 14 |
+
initialize_mongodb_connection,
|
| 15 |
+
get_student_data,
|
| 16 |
+
store_application_request,
|
| 17 |
+
store_morphosyntax_result,
|
| 18 |
+
store_semantic_result,
|
| 19 |
+
store_discourse_analysis_result,
|
| 20 |
+
store_chat_history,
|
| 21 |
+
create_admin_user,
|
| 22 |
+
create_student_user
|
| 23 |
+
)
|
| 24 |
+
return {
|
| 25 |
+
'initialize_mongodb_connection': initialize_mongodb_connection,
|
| 26 |
+
'get_student_data': get_student_data,
|
| 27 |
+
'store_application_request': store_application_request,
|
| 28 |
+
'store_morphosyntax_result': store_morphosyntax_result,
|
| 29 |
+
'store_semantic_result': store_semantic_result,
|
| 30 |
+
'store_discourse_analysis_result': store_discourse_analysis_result,
|
| 31 |
+
'store_chat_history': store_chat_history,
|
| 32 |
+
'create_admin_user': create_admin_user,
|
| 33 |
+
'create_student_user': create_student_user
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
def load_ui_functions():
|
| 37 |
+
from modules.ui.ui import (
|
| 38 |
+
main,
|
| 39 |
+
login_register_page,
|
| 40 |
+
login_form,
|
| 41 |
+
register_form,
|
| 42 |
+
user_page,
|
| 43 |
+
display_student_progress,
|
| 44 |
+
display_morphosyntax_analysis_interface,
|
| 45 |
+
display_semantic_analysis_interface,
|
| 46 |
+
display_discourse_analysis_interface,
|
| 47 |
+
display_chatbot_interface
|
| 48 |
+
)
|
| 49 |
+
return {
|
| 50 |
+
'main': main,
|
| 51 |
+
'login_register_page': login_register_page,
|
| 52 |
+
'login_form': login_form,
|
| 53 |
+
'register_form': register_form,
|
| 54 |
+
'user_page': user_page,
|
| 55 |
+
'display_student_progress': display_student_progress,
|
| 56 |
+
'display_morphosyntax_analysis_interface': display_morphosyntax_analysis_interface,
|
| 57 |
+
'display_semantic_analysis_interface': display_semantic_analysis_interface,
|
| 58 |
+
'display_discourse_analysis_interface': display_discourse_analysis_interface,
|
| 59 |
+
'display_chatbot_interface': display_chatbot_interface
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
def load_admin_functions():
|
| 63 |
+
from modules.admin.admin_ui import admin_page
|
| 64 |
+
return {
|
| 65 |
+
'admin_page': admin_page
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
def morpho_analysis_functions():
|
| 69 |
+
from modules.analysis_text.morpho_analysis import (
|
| 70 |
+
get_repeated_words_colors,
|
| 71 |
+
highlight_repeated_words,
|
| 72 |
+
POS_COLORS,
|
| 73 |
+
POS_TRANSLATIONS,
|
| 74 |
+
perform_advance_morphosyntax_analysis
|
| 75 |
+
)
|
| 76 |
+
return {
|
| 77 |
+
'get_repeated_words_colors': get_repeated_words_colors,
|
| 78 |
+
'highlight_repeated_words': highlight_repeated_words,
|
| 79 |
+
'POS_COLORS': POS_COLORS,
|
| 80 |
+
'POS_TRANSLATIONS': POS_TRANSLATIONS,
|
| 81 |
+
'perform_advance_morphosyntax_analysis' : perform_advance_morphosyntax_analysis
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
def semantic_analysis_text_functions():
|
| 85 |
+
from modules.analysis_text.semantic_analysis import (
|
| 86 |
+
visualize_semantic_relations,
|
| 87 |
+
perform_semantic_analysis,
|
| 88 |
+
create_semantic_graph
|
| 89 |
+
)
|
| 90 |
+
return {
|
| 91 |
+
'visualize_semantic_relations': visualize_semantic_relations,
|
| 92 |
+
'perform_semantic_analysis': perform_semantic_analysis,
|
| 93 |
+
'create_semantic_graph': create_semantic_graph
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
def discourse_analysis_text_functions():
|
| 97 |
+
from modules.analysis_text.discourse_analysis import (
|
| 98 |
+
perform_discourse_analysis,
|
| 99 |
+
compare_semantic_analysis
|
| 100 |
+
)
|
| 101 |
+
return {
|
| 102 |
+
'perform_discourse_analysis': perform_discourse_analysis,
|
| 103 |
+
'compare_semantic_analysis': compare_semantic_analysis
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
def spacy_utils_functions():
|
| 107 |
+
from modules.utils.spacy_utils import load_spacy_models
|
| 108 |
+
return {
|
| 109 |
+
'load_spacy_models': load_spacy_models
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
def chatbot_functions():
|
| 113 |
+
from modules.chatbot.chatbot import (
|
| 114 |
+
initialize_chatbot,
|
| 115 |
+
get_chatbot_response,
|
| 116 |
+
ClaudeAPIChat
|
| 117 |
+
)
|
| 118 |
+
return {
|
| 119 |
+
'initialize_chatbot': initialize_chatbot,
|
| 120 |
+
'get_chatbot_response': get_chatbot_response,
|
| 121 |
+
'ClaudeAPIChat': ClaudeAPIChat
|
| 122 |
+
}
|
| 123 |
|
| 124 |
+
# Opcional: funci贸n para cargar todas las funciones
|
| 125 |
+
def load_all_functions():
|
| 126 |
+
return {
|
| 127 |
+
**load_auth_functions(),
|
| 128 |
+
**load_database_function(),
|
| 129 |
+
**load_ui_functions(),
|
| 130 |
+
**load_admin_functions(),
|
| 131 |
+
**morpho_analysis_functions(),
|
| 132 |
+
**semantic_analysis_text_functions(),
|
| 133 |
+
**discourse_analysis_text_functions(),
|
| 134 |
+
**spacy_utils_functions(),
|
| 135 |
+
**chatbot_functions()
|
| 136 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|