AIdeaText commited on
Commit
73c2214
1 Parent(s): 8ce1b9a

Update modules/__init__.py

Browse files
Files changed (1) hide show
  1. modules/__init__.py +133 -82
modules/__init__.py CHANGED
@@ -1,85 +1,136 @@
1
  # modules/__init__.py
2
 
3
- from .auth import authenticate_user, register_user
4
- from .database import (
5
- initialize_mongodb_connection,
6
- get_student_data,
7
- store_application_request,
8
- store_morphosyntax_result,
9
- store_semantic_result,
10
- store_discourse_analysis_result,
11
- store_chat_history,
12
- create_admin_user,
13
- create_student_user
14
- )
15
- from .ui import (
16
- main,
17
- login_register_page,
18
- login_form,
19
- register_form,
20
- user_page,
21
- display_student_progress,
22
- display_morphosyntax_analysis_interface,
23
- display_semantic_analysis_interface,
24
- display_discourse_analysis_interface,
25
- display_chatbot_interface
26
- )
27
- from .admin_ui import admin_page # Añade esta línea
28
- from .morpho_analysis import (
29
- get_repeated_words_colors,
30
- highlight_repeated_words,
31
- POS_COLORS,
32
- POS_TRANSLATIONS
33
- )
34
- from .semantic_analysis import (
35
- visualize_semantic_relations,
36
- perform_semantic_analysis,
37
- create_semantic_graph
38
- )
39
- from .discourse_analysis import (
40
- perform_discourse_analysis,
41
- compare_semantic_analysis
42
- )
43
- from .spacy_utils import load_spacy_models
44
- from .chatbot import (
45
- initialize_chatbot,
46
- get_chatbot_response,
47
- ClaudeAPIChat # Nueva clase
48
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
- __all__ = [
51
- 'authenticate_user',
52
- 'register_user',
53
- 'initialize_mongodb_connection',
54
- 'get_student_data',
55
- 'store_morphosyntax_result',
56
- 'store_semantic_result',
57
- 'store_discourse_analysis_result',
58
- 'store_chat_history',
59
- 'create_admin_user',
60
- 'create_student_user',
61
- 'main',
62
- 'login_register_page',
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
+ }