robert 2.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. robert/__init__.py +9 -0
  2. robert/__main__.py +20 -0
  3. robert/_version.py +3 -0
  4. robert/api.py +646 -0
  5. robert/aqme.py +280 -0
  6. robert/argument_parser.py +98 -0
  7. robert/checkml.py +433 -0
  8. robert/checkml_score.py +50 -0
  9. robert/curate.py +217 -0
  10. robert/evaluate_bot_retrieval.py +125 -0
  11. robert/evaluate_bot_support.py +102 -0
  12. robert/evaluate_workflow_summaries.py +87 -0
  13. robert/export_bot_docs_knowledge.py +1632 -0
  14. robert/generate.py +249 -0
  15. robert/generate_utils.py +311 -0
  16. robert/gui_easyrob/__init__.py +0 -0
  17. robert/gui_easyrob/assets/gif_easyrob.gif +0 -0
  18. robert/gui_easyrob/bot/__init__.py +47 -0
  19. robert/gui_easyrob/bot/answer_metadata.py +198 -0
  20. robert/gui_easyrob/bot/bot_context.py +679 -0
  21. robert/gui_easyrob/bot/bot_engine.py +1100 -0
  22. robert/gui_easyrob/bot/bot_panel.py +1231 -0
  23. robert/gui_easyrob/bot/bot_rag.py +1178 -0
  24. robert/gui_easyrob/bot/bot_window.py +39 -0
  25. robert/gui_easyrob/bot/bot_worker.py +149 -0
  26. robert/gui_easyrob/bot/credential_store.py +143 -0
  27. robert/gui_easyrob/bot/error_parser.py +105 -0
  28. robert/gui_easyrob/bot/evidence_policy.py +164 -0
  29. robert/gui_easyrob/bot/heuristics.py +859 -0
  30. robert/gui_easyrob/bot/icons.py +56 -0
  31. robert/gui_easyrob/bot/input_csv_audit.py +212 -0
  32. robert/gui_easyrob/bot/knowledge/aqme_context.json +5907 -0
  33. robert/gui_easyrob/bot/knowledge/robert_context.json +4817 -0
  34. robert/gui_easyrob/bot/knowledge/ui_context.json +8293 -0
  35. robert/gui_easyrob/bot/knowledge_schema.py +1252 -0
  36. robert/gui_easyrob/bot/knowledge_sources/aqme_user_guidance.json +442 -0
  37. robert/gui_easyrob/bot/knowledge_sources/coverage_manifest.json +95 -0
  38. robert/gui_easyrob/bot/knowledge_sources/robert_user_guidance.json +471 -0
  39. robert/gui_easyrob/bot/knowledge_sources/ui_user_guidance.json +1312 -0
  40. robert/gui_easyrob/bot/llm_providers.py +1573 -0
  41. robert/gui_easyrob/bot/online_docs.py +105 -0
  42. robert/gui_easyrob/bot/prompt_policy.py +575 -0
  43. robert/gui_easyrob/bot/question_intent.py +562 -0
  44. robert/gui_easyrob/bot/response_quality.py +104 -0
  45. robert/gui_easyrob/bot/result_insights.py +225 -0
  46. robert/gui_easyrob/bot/token_usage.py +75 -0
  47. robert/gui_easyrob/bot/workflow_results.py +1396 -0
  48. robert/gui_easyrob/checkml_launcher.py +15 -0
  49. robert/gui_easyrob/easyrob.py +29 -0
  50. robert/gui_easyrob/easyrob_launcher.py +113 -0
  51. robert/gui_easyrob/main/__init__.py +9 -0
  52. robert/gui_easyrob/main/window.py +5152 -0
  53. robert/gui_easyrob/result_navigation.py +14 -0
  54. robert/gui_easyrob/tabs/__init__.py +23 -0
  55. robert/gui_easyrob/tabs/advanced_options.py +370 -0
  56. robert/gui_easyrob/tabs/aqme.py +1234 -0
  57. robert/gui_easyrob/tabs/checkml.py +898 -0
  58. robert/gui_easyrob/tabs/images.py +427 -0
  59. robert/gui_easyrob/tabs/interactive_predictions.py +555 -0
  60. robert/gui_easyrob/tabs/molssi.py +447 -0
  61. robert/gui_easyrob/tabs/predictions.py +484 -0
  62. robert/gui_easyrob/tabs/result_catalog.py +170 -0
  63. robert/gui_easyrob/tabs/results.py +490 -0
  64. robert/gui_easyrob/tabs/results_workspace.py +120 -0
  65. robert/gui_easyrob/test_bot_input_csv_audit.py +152 -0
  66. robert/gui_easyrob/test_bot_question_routing.py +383 -0
  67. robert/gui_easyrob/test_bot_result_analysis.py +356 -0
  68. robert/gui_easyrob/test_bot_retrieval_evaluation.py +110 -0
  69. robert/gui_easyrob/test_bot_ui_integration.py +278 -0
  70. robert/gui_easyrob/test_checkml_app_mode.py +124 -0
  71. robert/gui_easyrob/test_checkml_completion.py +57 -0
  72. robert/gui_easyrob/test_checkml_defaults.py +37 -0
  73. robert/gui_easyrob/test_checkml_result_summary.py +113 -0
  74. robert/gui_easyrob/test_checkml_web_mode.py +57 -0
  75. robert/gui_easyrob/test_dialog_layout.py +33 -0
  76. robert/gui_easyrob/test_gui_bot_regressions.py +320 -0
  77. robert/gui_easyrob/test_molssi_auto.py +569 -0
  78. robert/gui_easyrob/test_tutorial_view.py +215 -0
  79. robert/gui_easyrob/tutorials/check_model.md +25 -0
  80. robert/gui_easyrob/tutorials/chemdraw.md +49 -0
  81. robert/gui_easyrob/tutorials/csv.md +53 -0
  82. robert/gui_easyrob/tutorials/descriptors.md +21 -0
  83. robert/gui_easyrob/tutorials/overview.md +65 -0
  84. robert/gui_easyrob/tutorials/predictions.md +25 -0
  85. robert/gui_easyrob/tutorials/robbot.md +29 -0
  86. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_1.png +0 -0
  87. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_2.png +0 -0
  88. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_3.png +0 -0
  89. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_4.png +0 -0
  90. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_5.png +0 -0
  91. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_6.png +0 -0
  92. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_7.png +0 -0
  93. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_1.png +0 -0
  94. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_10.png +0 -0
  95. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_11.png +0 -0
  96. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_12.png +0 -0
  97. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_13.png +0 -0
  98. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_2.png +0 -0
  99. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_3.png +0 -0
  100. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_4.png +0 -0
  101. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_5.png +0 -0
  102. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_6.png +0 -0
  103. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_7.png +0 -0
  104. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_8.png +0 -0
  105. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_9.png +0 -0
  106. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1.png +0 -0
  107. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_1.png +0 -0
  108. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_2.png +0 -0
  109. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_3.png +0 -0
  110. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_4.png +0 -0
  111. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_5.png +0 -0
  112. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_2.png +0 -0
  113. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_3.png +0 -0
  114. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_4.png +0 -0
  115. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_5.png +0 -0
  116. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_6.png +0 -0
  117. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_7.png +0 -0
  118. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_8.png +0 -0
  119. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_9.png +0 -0
  120. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_1.png +0 -0
  121. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_2.png +0 -0
  122. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_3.png +0 -0
  123. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_4.png +0 -0
  124. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_5.png +0 -0
  125. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_6.png +0 -0
  126. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1.png +0 -0
  127. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_1.png +0 -0
  128. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_2.png +0 -0
  129. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_3.png +0 -0
  130. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_4.png +0 -0
  131. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_5.png +0 -0
  132. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_6.png +0 -0
  133. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_7.png +0 -0
  134. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_8.png +0 -0
  135. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_2.png +0 -0
  136. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_3.png +0 -0
  137. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_4.png +0 -0
  138. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5.png +0 -0
  139. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_1.png +0 -0
  140. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_2.png +0 -0
  141. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_3.png +0 -0
  142. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_6.png +0 -0
  143. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1.png +0 -0
  144. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1_1.png +0 -0
  145. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_2.png +0 -0
  146. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_3.png +0 -0
  147. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_4.png +0 -0
  148. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_5.png +0 -0
  149. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_6.png +0 -0
  150. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_1.png +0 -0
  151. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_2.png +0 -0
  152. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_3.png +0 -0
  153. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_4.png +0 -0
  154. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_5.png +0 -0
  155. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_6.png +0 -0
  156. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_7.png +0 -0
  157. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_8.png +0 -0
  158. robert/gui_easyrob/utils/__init__.py +0 -0
  159. robert/gui_easyrob/utils/aqme_utils.py +238 -0
  160. robert/gui_easyrob/utils/molssi_utils.py +584 -0
  161. robert/gui_easyrob/utils/predictions_utils.py +985 -0
  162. robert/gui_easyrob/utils/utils_gui.py +738 -0
  163. robert/gui_easyrob/version.py +68 -0
  164. robert/gui_easyrob/web/app.css +484 -0
  165. robert/gui_easyrob/web/app.html +134 -0
  166. robert/gui_easyrob/web/app.js +764 -0
  167. robert/gui_easyrob/web/checkml_brand.png +0 -0
  168. robert/gui_easyrob/web/easyrob_background.gif +0 -0
  169. robert/gui_easyrob/web/easyrob_background.png +0 -0
  170. robert/gui_easyrob/web/images.css +89 -0
  171. robert/gui_easyrob/web/images.html +39 -0
  172. robert/gui_easyrob/web/images.js +101 -0
  173. robert/gui_easyrob/web/results.js +499 -0
  174. robert/gui_easyrob/web/robert_brand.png +0 -0
  175. robert/gui_easyrob/web_dialogs.py +64 -0
  176. robert/gui_easyrob/web_results.py +253 -0
  177. robert/gui_easyrob/web_shell.py +684 -0
  178. robert/gui_easyrob/workflow_progress.py +89 -0
  179. robert/gui_easyrob/workflow_run_lock.py +27 -0
  180. robert/icons/CheckML_icon.png +0 -0
  181. robert/icons/Robert_icon.png +0 -0
  182. robert/icons/Robert_logo.jpg +0 -0
  183. robert/icons/Robert_logo_transparent.png +0 -0
  184. robert/icons/documentation_icon.png +0 -0
  185. robert/icons/info_icon.png +0 -0
  186. robert/icons/pdf_icon.png +0 -0
  187. robert/icons/play_icon.png +0 -0
  188. robert/icons/stop_icon.png +0 -0
  189. robert/icons/youtube_icon.ico +0 -0
  190. robert/predict.py +193 -0
  191. robert/predict_utils.py +410 -0
  192. robert/report/CheckML_logo.jpg +0 -0
  193. robert/report/GENERATE.png +0 -0
  194. robert/report/Robert_icon.ico +0 -0
  195. robert/report/Robert_logo.jpg +0 -0
  196. robert/report/Robert_logo1.jpg +0 -0
  197. robert/report/abbrev.png +0 -0
  198. robert/report/adv_anal.png +0 -0
  199. robert/report/checkml_pass.svg +3 -0
  200. robert/report/checkml_unclear.svg +3 -0
  201. robert/report/checkml_warning.svg +3 -0
  202. robert/report/features.png +0 -0
  203. robert/report/outliers.png +0 -0
  204. robert/report/pred.png +0 -0
  205. robert/report/repro.png +0 -0
  206. robert/report/robust_x.png +0 -0
  207. robert/report/robust_y_high.png +0 -0
  208. robert/report/robust_y_low.png +0 -0
  209. robert/report/score.png +0 -0
  210. robert/report/score_0.jpg +0 -0
  211. robert/report/score_1.jpg +0 -0
  212. robert/report/score_10.jpg +0 -0
  213. robert/report/score_2.jpg +0 -0
  214. robert/report/score_3.jpg +0 -0
  215. robert/report/score_4.jpg +0 -0
  216. robert/report/score_5.jpg +0 -0
  217. robert/report/score_6.jpg +0 -0
  218. robert/report/score_7.jpg +0 -0
  219. robert/report/score_8.jpg +0 -0
  220. robert/report/score_9.jpg +0 -0
  221. robert/report/score_gray_0.jpg +0 -0
  222. robert/report/score_gray_1.jpg +0 -0
  223. robert/report/score_gray_10.jpg +0 -0
  224. robert/report/score_gray_2.jpg +0 -0
  225. robert/report/score_gray_3.jpg +0 -0
  226. robert/report/score_gray_4.jpg +0 -0
  227. robert/report/score_gray_5.jpg +0 -0
  228. robert/report/score_gray_6.jpg +0 -0
  229. robert/report/score_gray_7.jpg +0 -0
  230. robert/report/score_gray_8.jpg +0 -0
  231. robert/report/score_gray_9.jpg +0 -0
  232. robert/report/score_w_1_0.jpg +0 -0
  233. robert/report/score_w_1_1.jpg +0 -0
  234. robert/report/score_w_2_0.jpg +0 -0
  235. robert/report/score_w_2_1.jpg +0 -0
  236. robert/report/score_w_2_2.jpg +0 -0
  237. robert/report/score_w_2_gray_0.jpg +0 -0
  238. robert/report/score_w_2_gray_1.jpg +0 -0
  239. robert/report/score_w_2_gray_2.jpg +0 -0
  240. robert/report/score_w_3_0.jpg +0 -0
  241. robert/report/score_w_3_1.jpg +0 -0
  242. robert/report/score_w_3_2.jpg +0 -0
  243. robert/report/score_w_3_3.jpg +0 -0
  244. robert/report/score_w_4_0.jpg +0 -0
  245. robert/report/score_w_4_1.JPG +0 -0
  246. robert/report/score_w_4_2.jpg +0 -0
  247. robert/report/score_w_4_3.jpg +0 -0
  248. robert/report/score_w_4_4.jpg +0 -0
  249. robert/report/transpa.png +0 -0
  250. robert/report/y_distrib.png +0 -0
  251. robert/report.py +2880 -0
  252. robert/report_utils.py +2270 -0
  253. robert/robert.py +181 -0
  254. robert/utils.py +4763 -0
  255. robert/verify.py +606 -0
  256. robert-2.2.0.dist-info/METADATA +55 -0
  257. robert-2.2.0.dist-info/RECORD +261 -0
  258. robert-2.2.0.dist-info/WHEEL +5 -0
  259. robert-2.2.0.dist-info/entry_points.txt +3 -0
  260. robert-2.2.0.dist-info/licenses/LICENSE +21 -0
  261. robert-2.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,562 @@
1
+ """Question intent classification for the EasyROB bot."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ import unicodedata
7
+ from typing import Mapping, Sequence
8
+
9
+ __all__ = [
10
+ "classify_question_intent",
11
+ "is_gui_question",
12
+ "is_explicit_web_request",
13
+ "is_generic_question",
14
+ "is_follow_up_question",
15
+ "is_workflow_result_question",
16
+ "requires_fresh_information",
17
+ "select_inference_history",
18
+ "last_completed_exchange",
19
+ ]
20
+
21
+
22
+ _TOKEN_RE = re.compile(r"[a-z0-9_]+")
23
+
24
+ _DIAGNOSTIC_PHRASES = (
25
+ "why is",
26
+ "why are",
27
+ "why can",
28
+ "why can't",
29
+ "cannot run",
30
+ "can't run",
31
+ "not working",
32
+ "doesn't work",
33
+ "disabled",
34
+ "blocked",
35
+ "error",
36
+ "failed",
37
+ "failure",
38
+ "warning",
39
+ "not found",
40
+ "locked",
41
+ "por que",
42
+ "no funciona",
43
+ "deshabilitad",
44
+ "bloquead",
45
+ "fallo",
46
+ "advertencia",
47
+ )
48
+ _TUTORIAL_PHRASES = (
49
+ "how do i",
50
+ "how can i",
51
+ "how to",
52
+ "what do i need",
53
+ "which parameters",
54
+ "what parameters",
55
+ "how it works",
56
+ "how does",
57
+ "what is",
58
+ "where can i",
59
+ "what should i do next",
60
+ )
61
+ _RESULTS_TERMS = {
62
+ "resultado", "resultados", "informe", "informes", "metrica", "metricas",
63
+ "prediccion", "predicciones", "puntuacion", "puntuaciones",
64
+ "result",
65
+ "results",
66
+ "metric",
67
+ "metrics",
68
+ "rmse",
69
+ "mae",
70
+ "r2",
71
+ "squared",
72
+ "accuracy",
73
+ "score",
74
+ "scores",
75
+ "report",
76
+ "reports",
77
+ "prediction",
78
+ "predictions",
79
+ "no_pfi",
80
+ "interpret",
81
+ "interpretation",
82
+ "model",
83
+ "models",
84
+ }
85
+ _METRIC_TERMS = {
86
+ "rmse",
87
+ "mae",
88
+ "r2",
89
+ "accuracy",
90
+ "score",
91
+ "scores",
92
+ "metric",
93
+ "metrics",
94
+ }
95
+ _PARAMETER_TERMS = {
96
+ "parameter",
97
+ "parameters",
98
+ "option",
99
+ "options",
100
+ "threshold",
101
+ "cutoff",
102
+ "setting",
103
+ "settings",
104
+ "pfi",
105
+ }
106
+ _MODULE_TERMS = {
107
+ "generate",
108
+ "curate",
109
+ "predict",
110
+ "verify",
111
+ "qdescp",
112
+ "csearch",
113
+ "cmin",
114
+ "qcorr",
115
+ "qprep",
116
+ }
117
+ _NAMED_SUBJECTS = _MODULE_TERMS | _METRIC_TERMS | {"aqme", "robert", "pfi", "shap"}
118
+ _TUTORIAL_TERMS = {
119
+ "how",
120
+ "use",
121
+ "using",
122
+ "start",
123
+ "setup",
124
+ "configure",
125
+ "parameter",
126
+ "parameters",
127
+ "option",
128
+ "options",
129
+ "need",
130
+ "before",
131
+ "workflow",
132
+ "works",
133
+ }
134
+ _FOLLOW_UP_TERMS = {
135
+ "it",
136
+ "that",
137
+ "this",
138
+ "those",
139
+ "these",
140
+ "them",
141
+ "there",
142
+ "and",
143
+ "also",
144
+ "then",
145
+ "enabled",
146
+ "disabled",
147
+ "tab",
148
+ }
149
+ _FOLLOW_UP_PHRASES = (
150
+ "what should i check next",
151
+ "what do i check next",
152
+ "what next",
153
+ "next step",
154
+ "explicamelo",
155
+ "explicalo",
156
+ "explicarlo mas",
157
+ "mas detalle",
158
+ "more detail",
159
+ )
160
+ _OPAQUE_FOLLOW_UPS = {
161
+ "what",
162
+ "what?",
163
+ "excuse me",
164
+ "excuse me?",
165
+ "sorry",
166
+ "sorry?",
167
+ "huh",
168
+ "huh?",
169
+ "why",
170
+ "why?",
171
+ "por que",
172
+ "por que?",
173
+ "como",
174
+ "como?",
175
+ }
176
+ _LIVE_CONTEXT_HINT_RE = re.compile(
177
+ r"\b(current|currently|here|now|just|popup|dialog|warning|message|alert|error|failed|failure|blocked|disabled|loaded|selected|shown|displayed|this|that|these|it|my|missing|overlap|ahora|actualmente|aqui|pestana|deshabilitada|deshabilitado|bloqueada|bloqueado|cargada|cargado|seleccionada|seleccionado|mi|mis|este|esta|estos|estas|falta|faltan|ausente|ausentes|solapamiento)\b",
178
+ re.IGNORECASE,
179
+ )
180
+ _GENERIC_TOPIC_HINT_RE = re.compile(
181
+ r"\b(?:aqme|robert|descriptors?|descriptores?|features?|machine learning|models?|modelos?|"
182
+ r"molecules?|predictions?|predicciones?|concept|meaning|difference|rmse|mae|r2|accuracy|"
183
+ r"metrics?|metricas?|pfi|no_pfi|shap|overfitting|cross[- ]validation|regression|classification)\b",
184
+ )
185
+ _EXPLANATION_RE = re.compile(
186
+ r"^(?:(?:and|y)\s+)?(?:what (?:is|are|does|do)\b|what['’]s\b|what .+ means?\b|"
187
+ r"how (?:does|do|to)\b|how many .+ (?:does|do)\b|why (?:does|do|is|are)\b|"
188
+ r"(?:can you )?(?:explain|define)\b|que (?:es|son|significa|hace|hacen|muestra)\b|"
189
+ r"como (?:funciona|funcionan)\b|"
190
+ r"(?:puedes )?explic(?:a|ar|ame)\b|define\b|difference between\b|(?:que )?diferencia (?:hay )?entre\b)",
191
+ )
192
+ _GUI_CONTROL_RE = re.compile(
193
+ r"\b(?:buttons?|tabs?|pop[- ]?ups?|dialogs?|checkbox(?:es)?|drop[- ]?downs?|toggles?|"
194
+ r"message box|boton(?:es)?|pestanas?|ventanas?|dialogos?|casillas?|desplegables?)\b|"
195
+ r"\b(?:views?|vistas?)\s+(?:is\s+|esta\s+)?(?:enabled|disabled|available|unavailable|"
196
+ r"habilitada|deshabilitada|disponible)\b",
197
+ )
198
+ _GUI_MESSAGE_RE = re.compile(
199
+ r"\b(?:this|that|the|este|esta|ese|esa)\s+(?:warning|error|alert|message|advertencia|aviso|mensaje)\b|"
200
+ r"\b(?:warning|error|alert|message|advertencia|aviso|mensaje)\s+(?:on screen|displayed|en pantalla)\b",
201
+ )
202
+ _GUI_PROCEDURE_RE = re.compile(
203
+ r"^(?:(?:how (?:do|can|should) i|how to|where (?:do|can) i)\s+"
204
+ r"(?:run|start|load|open|find|view|configure|set|activate|enable|export|save|train)\b|"
205
+ r"(?:como|donde)\s+(?:ejecut\w+|inici\w+|carg\w+|abr\w+|encuentr\w+|ver|"
206
+ r"configur\w+|activ\w+|export\w+|guard\w+|entren\w+)\b)",
207
+ )
208
+ _SUMMARY_COMMAND_RE = re.compile(
209
+ r"^(?:(?:please|por favor)[, ]+)?(?:summari[sz]e|resumen|resume|resumir)"
210
+ r"(?:[ .?!]*$|\s+(?:(?:my|our|the|this|el|los|mi|mis|este)\s+)?"
211
+ r"(?:(?:robert|aqme)\s+)?(?:results?|resultados?|reports?|informes?|run|"
212
+ r"ejecucion|workflow|flujo|all models|todos los modelos)\b)",
213
+ )
214
+ _RESULT_SUBJECT_RE = re.compile(
215
+ r"\b(?:results?|resultados?|reports?|informes?|metrics?|metricas?|rmse|mae|r2|r\^2|"
216
+ r"roc[- _]?auc|auc|accuracy|f1|mcc|scores?|puntuaciones?|test|validation|validacion|"
217
+ r"predictions?|predicciones?|outliers?|warnings?|advertencias?|avisos?|errores?|"
218
+ r"shap|pfi|no_pfi|features?|importance|importancia|descriptors?|descriptores?|"
219
+ r"uncertaint(?:y|ies)|incertidumbres?|overlap|solapamiento|leakage|"
220
+ r"outputs?|salidas?|files?|archivos?|curate|generate|verify|predict|aqme|qdescp|csearch|robert|"
221
+ r"workflow|flujo|run|ejecucion|models?|modelos?|solvent|disolvente|solvente)\b",
222
+ )
223
+ _RUN_REFERENCE_RE = re.compile(
224
+ r"\b(?:my|our|this|the last|mi|mis|nuestros?|esta|este|ultima|ultimo)\s+"
225
+ r"(?:robert\s+|aqme\s+)?(?:results?|resultados?|run|ejecucion|workflow|flujo|reports?|informes?|"
226
+ r"predictions?|predicciones?|metrics?|metricas?|rmse|mae|r2|score|puntuacion|pfi|shap|csvs?)\b|"
227
+ r"\b(?:in|from|of|en|del)\s+(?:the|el|los)\s+(?:results?|resultados?|run|reports?|informes?)\b",
228
+ )
229
+ _RUN_OUTCOME_RE = re.compile(
230
+ r"\b(?:did|was|were|passed|failed|finished|completed|happened|generated|produced|created|"
231
+ r"obtained|recorded|fue|fueron|dio|dieron|paso|aprobo|fallo|termino|ocurrio|se ejecuto|"
232
+ r"generad[oa]s?|genero|generaron|produjo|cread[oa]s?|obtuve|obtuvimos)\b",
233
+ )
234
+ _RESULT_REQUEST_RE = re.compile(
235
+ r"\b(?:show|compare|interpret|analy[sz]e|muestra|muestran|compara|interpreta|analiza|"
236
+ r"faltan|missing|best|mejores?)\b",
237
+ )
238
+ _FOCUSED_RESULT_RE = re.compile(
239
+ r"\b(?:shap|pfi|no_pfi|rmse|mae|r2)\s+(?:for|para)\s+[a-z0-9_]{2,4}\s*[?.!]*$|"
240
+ r"\b(?:test|train|validation|validacion)\s+(?:rmse|mae|r2|accuracy|f1|mcc|score)\b|"
241
+ r"\b(?:the|los|el)\s+(?:results?|resultados?|metrics?|metricas?|best model|mejor modelo)\s*[?.!]*$",
242
+ )
243
+ _OPERATIONAL_HINT_RE = re.compile(
244
+ r"\b(where|file|folder|path|project|csv|smiles|load|open|select|enable|disable|run|click|button|tab|start|configure|set|archivo|carpeta|ruta|proyecto|cargar|abrir|seleccionar|activar|desactivar|ejecutar|pulsar|boton|pestana|configurar)\b",
245
+ re.IGNORECASE,
246
+ )
247
+ _GREETING_TERMS = {
248
+ "hi",
249
+ "hello",
250
+ "hey",
251
+ "heyy",
252
+ "ey",
253
+ "yo",
254
+ "hola",
255
+ "buenas",
256
+ "hello!",
257
+ "hi!",
258
+ "hey!",
259
+ }
260
+ _GREETING_PHRASES = (
261
+ "how are you",
262
+ "how are u",
263
+ "how ar eu",
264
+ "how r u",
265
+ "how's it going",
266
+ "how is it going",
267
+ )
268
+ _GREETING_PHRASE_TERMS = _GREETING_TERMS | {
269
+ "how", "are", "you", "u", "ar", "eu", "doing", "today", "is", "it", "going", "s",
270
+ }
271
+ _EXPLICIT_WEB_RE = re.compile(
272
+ r"\b(?:search|look up|browse|buscar|busca|consulta)\b.*\b(?:web|internet|online|en linea)\b",
273
+ re.IGNORECASE,
274
+ )
275
+ _FRESH_INFORMATION_RE = re.compile(
276
+ r"\b(?:latest|newest|recent|today|this week|this month|currently available|"
277
+ r"current (?:[a-z0-9_.-]+ ){0,3}(?:version|release|documentation|docs|price|status|recommendation)|"
278
+ r"ultima version|última versión|mas reciente|más reciente|hoy|esta semana|actualmente disponible)\b",
279
+ re.IGNORECASE,
280
+ )
281
+
282
+
283
+ def _normalize_text(value: object) -> str:
284
+ normalized = unicodedata.normalize("NFKD", str(value or ""))
285
+ normalized = "".join(character for character in normalized if not unicodedata.combining(character))
286
+ return " ".join(normalized.casefold().split())
287
+
288
+
289
+ def _tokenize(value: str) -> set[str]:
290
+ return set(_TOKEN_RE.findall(_normalize_text(value)))
291
+
292
+
293
+ def _last_user_message(conversation_history: Sequence[Mapping[str, str]] | None) -> str:
294
+ if not conversation_history:
295
+ return ""
296
+ for message in reversed(conversation_history):
297
+ if str(message.get("role", "")).strip().lower() != "user":
298
+ continue
299
+ content = str(message.get("content", "")).strip()
300
+ if content:
301
+ return content
302
+ return ""
303
+
304
+
305
+ def _looks_like_follow_up(question: str, tokens: set[str]) -> bool:
306
+ if not tokens:
307
+ return False
308
+ named_subject = re.match(
309
+ r"^(?:and|y) (?:what (?:does|do|is|are)|how (?:does|do)|"
310
+ r"que (?:hace|es|son)|como funciona) ([a-z0-9_]+)\b",
311
+ question,
312
+ )
313
+ if named_subject and named_subject.group(1) in _NAMED_SUBJECTS | {"a", "an", "un", "una"}:
314
+ return False
315
+ if any(phrase in question for phrase in _FOLLOW_UP_PHRASES):
316
+ return True
317
+ if not tokens & {"rmse", "mae", "r2", "accuracy", "mcc", "f1", "auc"} and re.search(
318
+ r"\b(?:lower|higher|better|worse)\b.*\b(?:value|score|number)\b|"
319
+ r"\b(?:value|score|number)\b.*\b(?:lower|higher|better|worse)\b",
320
+ question,
321
+ ):
322
+ return True
323
+ if tokens & {"each", "either"} and tokens & {"use", "choose"}:
324
+ return True
325
+ if len(tokens) <= 8 and tokens & {
326
+ "it", "that", "this", "those", "these", "them",
327
+ "eso", "esto", "esos", "estos", "esas", "estas",
328
+ }:
329
+ return True
330
+ if re.search(r"\b(?:como|donde) (?:lo|la|los|las)\b", question):
331
+ return True
332
+ if question.startswith(("y ", "entonces ", "and ", "what about ", "what if ")):
333
+ return True
334
+ if question.startswith(("what is ", "what are ", "how does ", "how do i ", "how can i ", "which ", "where ")):
335
+ return False
336
+ if len(tokens) <= 5 and tokens & _FOLLOW_UP_TERMS:
337
+ return True
338
+ return question.startswith(("and ", "what about ", "what if ", "it ", "that "))
339
+
340
+
341
+ def is_follow_up_question(question: str) -> bool:
342
+ """Return whether *question* conservatively depends on prior conversation."""
343
+
344
+ clean_question = _normalize_text(question).lstrip("¿¡")
345
+ return clean_question in _OPAQUE_FOLLOW_UPS or _looks_like_follow_up(
346
+ clean_question, _tokenize(clean_question)
347
+ )
348
+
349
+
350
+ def is_explicit_web_request(question: str) -> bool:
351
+ """Return whether the user explicitly requested an online lookup."""
352
+ return type(question) is str and bool(_EXPLICIT_WEB_RE.search(question))
353
+
354
+
355
+ def requires_fresh_information(question: str) -> bool:
356
+ """Return whether a question depends on time-sensitive external facts."""
357
+ return type(question) is str and bool(_FRESH_INFORMATION_RE.search(question))
358
+
359
+
360
+ def is_gui_question(question: str) -> bool:
361
+ """Identify requests about interactive controls or an on-screen message."""
362
+ text = _normalize_text(question).lstrip("¿¡")
363
+ return bool(_GUI_CONTROL_RE.search(text) or _GUI_PROCEDURE_RE.search(text) or (
364
+ _GUI_MESSAGE_RE.search(text) and not _RUN_REFERENCE_RE.search(text)
365
+ ))
366
+
367
+
368
+ def is_workflow_result_question(
369
+ question: str,
370
+ intent: str | None = None,
371
+ *,
372
+ named_model: bool = False,
373
+ ) -> bool:
374
+ """Identify questions that depend on a particular workflow execution."""
375
+ text = _normalize_text(question).lstrip("¿¡")
376
+ if _SUMMARY_COMMAND_RE.match(text):
377
+ return True
378
+ if not text or is_gui_question(text):
379
+ return False
380
+ if _RUN_REFERENCE_RE.search(text) or re.search(r"\b(?:what happened|que ocurrio|que paso)\b", text):
381
+ return True
382
+ result_subject = bool(_RESULT_SUBJECT_RE.search(text))
383
+ if _FOCUSED_RESULT_RE.search(text) or (result_subject and named_model):
384
+ return True
385
+ if _EXPLANATION_RE.match(text):
386
+ return False
387
+ if _RUN_OUTCOME_RE.search(text):
388
+ return result_subject
389
+ return (intent or classify_question_intent(text)) == "results" or (
390
+ result_subject and bool(_RESULT_REQUEST_RE.search(text))
391
+ )
392
+
393
+
394
+ def is_generic_question(
395
+ question: str,
396
+ intent: str | None = None,
397
+ *,
398
+ conversation_history: Sequence[Mapping[str, str]] | None = None,
399
+ ) -> bool:
400
+ """Return whether a self-contained explanation should omit live GUI context."""
401
+ if type(question) is not str:
402
+ return False
403
+ clean_question = _normalize_text(question).lstrip("¿¡")
404
+ resolved_intent = (
405
+ str(intent or "").strip().lower()
406
+ or classify_question_intent(clean_question)
407
+ )
408
+ if is_gui_question(clean_question) or is_workflow_result_question(clean_question, resolved_intent):
409
+ return False
410
+ if any(marker in clean_question for marker in ("<", ">", "\x00")):
411
+ return False
412
+ if is_follow_up_question(clean_question):
413
+ previous = _last_user_message(conversation_history)
414
+ return bool(previous and is_generic_question(previous))
415
+ if _LIVE_CONTEXT_HINT_RE.search(clean_question):
416
+ return False
417
+ if _OPERATIONAL_HINT_RE.search(clean_question):
418
+ return False
419
+ return bool(_EXPLANATION_RE.match(clean_question) or _GENERIC_TOPIC_HINT_RE.search(clean_question))
420
+
421
+
422
+ def _canonical_history_record(record: object) -> dict[str, str] | None:
423
+ if not isinstance(record, Mapping):
424
+ return None
425
+ role = record.get("role")
426
+ content = record.get("content")
427
+ if not isinstance(role, str) or role not in {"user", "assistant"} or not isinstance(content, str):
428
+ return None
429
+ clean_content = content.strip()
430
+ if not clean_content or record.get("memory_eligible", True) is not True:
431
+ return None
432
+ return {"role": role, "content": clean_content}
433
+
434
+
435
+ def select_inference_history(
436
+ question: str,
437
+ conversation_history: Sequence[Mapping[str, object]] | None,
438
+ ) -> tuple[dict[str, str], ...]:
439
+ """Return the nearest complete standalone exchange behind a follow-up chain."""
440
+
441
+ if not is_follow_up_question(question):
442
+ return ()
443
+ records = tuple(conversation_history) if isinstance(conversation_history, (list, tuple)) else ()
444
+ selected = last_completed_exchange(records)
445
+ while (selected and len(records) >= 4
446
+ and _canonical_history_record(records[-2]) == selected[0]
447
+ and _canonical_history_record(records[-1]) == selected[1]
448
+ and is_follow_up_question(selected[0]["content"])):
449
+ previous_records = records[:-2]
450
+ previous = last_completed_exchange(previous_records)
451
+ if (not previous or _canonical_history_record(previous_records[-2]) != previous[0]
452
+ or _canonical_history_record(previous_records[-1]) != previous[1]):
453
+ break
454
+ selected = previous
455
+ records = previous_records
456
+ return selected
457
+
458
+
459
+ def last_completed_exchange(
460
+ conversation_history: Sequence[Mapping[str, object]] | None,
461
+ ) -> tuple[dict[str, str], ...]:
462
+ """Select adjacent eligible turns without joining across invalid records."""
463
+ records = tuple(conversation_history) if isinstance(conversation_history, (list, tuple)) else ()
464
+ if len(records) < 2:
465
+ return ()
466
+ user_record = _canonical_history_record(records[-2])
467
+ assistant_record = _canonical_history_record(records[-1])
468
+ if (
469
+ user_record is not None
470
+ and assistant_record is not None
471
+ and user_record["role"] == "user"
472
+ and assistant_record["role"] == "assistant"
473
+ ):
474
+ return (user_record, assistant_record)
475
+ return ()
476
+
477
+
478
+ def classify_question_intent(
479
+ question: str,
480
+ conversation_history: Sequence[Mapping[str, str]] | None = None,
481
+ ) -> str:
482
+ clean_question = _normalize_text(question)
483
+ tokens = _tokenize(clean_question)
484
+ if not clean_question:
485
+ return "tutorial"
486
+ if clean_question in _GREETING_TERMS:
487
+ return "greeting"
488
+ if tokens and len(tokens) <= 3 and tokens <= _GREETING_TERMS:
489
+ return "greeting"
490
+ if (
491
+ any(phrase in clean_question for phrase in _GREETING_PHRASES)
492
+ and tokens <= _GREETING_PHRASE_TERMS
493
+ ):
494
+ return "greeting"
495
+ if is_gui_question(clean_question):
496
+ if _GUI_MESSAGE_RE.search(clean_question) or any(phrase in clean_question for phrase in _DIAGNOSTIC_PHRASES):
497
+ return "diagnostic"
498
+ return "tutorial"
499
+ explanation_follow_up = bool(re.search(
500
+ r"\b(?:important|matter|importa)\b", clean_question,
501
+ )) and not bool(re.search(
502
+ r"\b(?:error|warning|failed|failure|blocked|disabled|fallo|"
503
+ r"advertencia|bloquead\w*|deshabilitad\w*)\b", clean_question,
504
+ ))
505
+ if is_follow_up_question(clean_question) and (
506
+ explanation_follow_up
507
+ or not any(phrase in clean_question for phrase in _DIAGNOSTIC_PHRASES)
508
+ ):
509
+ previous_user_question = _last_user_message(conversation_history)
510
+ if previous_user_question and previous_user_question.strip().lower() != clean_question:
511
+ previous_intent = classify_question_intent(previous_user_question, conversation_history=None)
512
+ if previous_intent != "greeting":
513
+ return previous_intent
514
+
515
+ diagnostic_score = sum(3 for phrase in _DIAGNOSTIC_PHRASES if phrase in clean_question)
516
+ tutorial_score = sum(2 for phrase in _TUTORIAL_PHRASES if phrase in clean_question)
517
+ results_score = len(tokens & _RESULTS_TERMS) * 2
518
+ if (tokens & {"mi", "mis", "este", "esta", "estos", "estas"}
519
+ and tokens & {"modelo", "modelos"}
520
+ and re.search(r"\b(?:mejor\w*|peor\w*|confi\w*|fiab\w*|rendim\w*|compar\w*|resultados?)\b", clean_question)):
521
+ results_score += 4
522
+ parameter_score = len(tokens & _PARAMETER_TERMS) * 2
523
+ module_score = len(tokens & _MODULE_TERMS) * 2
524
+
525
+ if {"run", "csv"} <= tokens:
526
+ diagnostic_score += 2
527
+ if {"tab", "enabled"} <= tokens or {"tab", "disabled"} <= tokens or {"tab", "locked"} <= tokens:
528
+ diagnostic_score += 2
529
+ if "r squared" in clean_question:
530
+ results_score += 6
531
+ if "predictions" in tokens and ("identical" in tokens or "same" in tokens):
532
+ results_score += 6
533
+ diagnostic_score = max(0, diagnostic_score - 3)
534
+ if "pfi" in tokens and ("no_pfi" in tokens or "no pfi" in clean_question or "vs" in tokens):
535
+ results_score += 6
536
+ parameter_score = max(0, parameter_score - 2)
537
+ if {"parameter", "robert"} <= tokens or {"parameters", "robert"} <= tokens:
538
+ tutorial_score += 3
539
+ if {"need", "run"} <= tokens or {"need", "workflow"} <= tokens:
540
+ tutorial_score += 2
541
+ if {"what", "does"} <= tokens and tokens & _PARAMETER_TERMS:
542
+ parameter_score += 2
543
+ if {"how", "interpret"} <= tokens or {"what", "mean"} <= tokens:
544
+ results_score += 2
545
+ if "what" in tokens and tokens & _METRIC_TERMS:
546
+ results_score += 2
547
+ if tokens & _MODULE_TERMS and ("what" in tokens or "how" in tokens):
548
+ module_score += 1
549
+
550
+ tutorial_score += len(tokens & _TUTORIAL_TERMS)
551
+
552
+ if diagnostic_score == 0 and results_score == 0 and tutorial_score == 0 and parameter_score == 0 and module_score == 0:
553
+ return "tutorial"
554
+ if diagnostic_score >= max(tutorial_score, results_score, parameter_score, module_score):
555
+ return "diagnostic"
556
+ if parameter_score >= max(results_score, tutorial_score, module_score) and parameter_score > 0:
557
+ return "parameter"
558
+ if results_score > max(tutorial_score, module_score):
559
+ return "results"
560
+ if module_score > tutorial_score:
561
+ return "module-explanation"
562
+ return "tutorial"
@@ -0,0 +1,104 @@
1
+ """Conservative calibration of unsupported predictive-performance guarantees."""
2
+
3
+ import re
4
+ from typing import Sequence
5
+
6
+
7
+ _VALIDATION = re.compile(r"\b(?:validation|validación|validacion|CV)\b", re.I)
8
+ _PROMISE = r"(?:guarante\w*|ensur\w*|garantiz\w*|asegur\w*)"
9
+ _QUALITY = r"(?:reliab\w*|accura\w*|unseen|generaliz\w*|fiabl\w*|precis\w*|no vistos)"
10
+ _UNSUPPORTED = re.compile(rf"\b{_PROMISE}\b[^.!?\n]{{0,140}}\b{_QUALITY}\b", re.I)
11
+ _NEGATED = re.compile(rf"\b(?:no|not|never|cannot|can't|doesn't)\s+(?:\w+\s+){{0,2}}{_PROMISE}", re.I)
12
+
13
+
14
+ def calibrate_validation_guarantees(text: str) -> str:
15
+ """Replace a narrow class of false guarantees, retaining correct caveats."""
16
+ if not _VALIDATION.search(text):
17
+ return text
18
+ pieces = re.split(r"((?<=[.!?])\s+(?=[A-ZÁÉÍÓÚ])|\n+)", text)
19
+ corrected = False
20
+ spanish = False
21
+ for index in range(0, len(pieces), 2):
22
+ sentence = pieces[index]
23
+ if sentence.rstrip().endswith("?") or _NEGATED.search(sentence):
24
+ continue
25
+ match = _UNSUPPORTED.search(sentence)
26
+ if match:
27
+ spanish = spanish or bool(re.search(r"garantiz|asegur", match.group(), re.I))
28
+ pieces[index] = ""
29
+ corrected = True
30
+ if not corrected:
31
+ return text
32
+ caveat = (
33
+ "La validación estima el rendimiento en datos no usados para entrenar; no garantiza predicciones fiables en datos nuevos."
34
+ if spanish else
35
+ "Validation estimates performance on data held out from training; it does not guarantee reliable predictions on new data."
36
+ )
37
+ remaining = re.sub(r"\n{3,}", "\n\n", "".join(pieces)).strip()
38
+ return f"{remaining}\n\n{caveat}" if remaining else caveat
39
+
40
+
41
+ def result_summary_issues(
42
+ text: str,
43
+ *,
44
+ metrics: Sequence[tuple[str, str, str, str]],
45
+ unchanged_test_set_warning: bool,
46
+ has_unresolved_verify_checks: bool = False,
47
+ ) -> tuple[str, ...]:
48
+ """Identify a few high-confidence contradictions before showing a report summary."""
49
+ issues = []
50
+ has_raw_test_rmse = any(
51
+ "rmse" in label.casefold() and "test" in scope.casefold()
52
+ for label, _, scope, _ in metrics
53
+ )
54
+ if has_raw_test_rmse and re.search(
55
+ r"\b(?:raw|unit[- ]based|original[- ]unit)\b[^.!?\n]{0,70}\bRMSE\b[^.!?\n]{0,90}"
56
+ r"\b(?:not (?:listed|provided|available|reported)|missing|absent|no values)\b|"
57
+ r"\b(?:no|without)\b[^.!?\n]{0,55}\b(?:raw|unit[- ]based)\b[^.!?\n]{0,50}\bRMSE\b",
58
+ text, re.I,
59
+ ):
60
+ issues.append("Raw test RMSE is present in PREDICT metrics; report its value rather than saying it is absent.")
61
+ if re.search(
62
+ r"\bone[- ‑]?hot\b[^.!?\n]{0,240}\bcategorical descriptors?\b|"
63
+ r"\bcategorical descriptors?\b[^.!?\n]{0,240}\bone[- ‑]?hot\b|"
64
+ r"\bzero[- /‑]?non[- ‑]?zero\b[^.!?\n]{0,100}\bcategorical descriptors?\b",
65
+ text, re.I,
66
+ ) and not re.search(r"\bnot (?:a |about )?categorical descriptor", text, re.I):
67
+ issues.append("VERIFY onehot tests zero/nonzero descriptor indicators; it does not identify categorical descriptors.")
68
+ if unchanged_test_set_warning and re.search(
69
+ r"\b(?:test[- ‑ ]set|test_set)\b[^.!?\n]{0,100}\b(?:forced|raised|changed|increased)\b|"
70
+ r"\b(?:forced|raised|changed|increased)\b[^.!?\n]{0,100}\b(?:test[- ‑ ]set|test_set)\b",
71
+ text, re.I,
72
+ ):
73
+ issues.append("The GENERATE warning reports 0.2 before and after; do not claim the test-set size changed.")
74
+ if re.search(
75
+ r"\b(?:scores?|puntuaci[oó]n(?:es)?)\b[^.!?\n]{0,95}\b(?:moderate|modest|strong|good|poor|bad|"
76
+ r"moderad[ao]|buen[ao]|mal[ao])\b[^.!?\n]{0,35}\b(?:performance|rendimiento|model|modelo)\b",
77
+ text, re.I,
78
+ ):
79
+ issues.append("A CheckML score is a checklist summary, not an absolute label for predictive quality.")
80
+ if re.search(
81
+ r"\b(?:pass(?:ed|ing)?|superad[oa]s?)\b[^.!?\n]{0,100}\b(?:not|no)\s+(?:simply\s+)?"
82
+ r"(?:memori[sz]\w*|overfit\w*|sobreajust\w*)\b",
83
+ text, re.I,
84
+ ):
85
+ issues.append("Passing baseline checks does not prove the model has not memorized or overfit.")
86
+ if re.search(
87
+ r"\b(?:feature engineering|stratified sampling|re-encod\w*|reencod\w*|"
88
+ r"collect(?:ing)? more data|recog(?:er|ida) m[aá]s datos|muestreo estratificado)\b",
89
+ text, re.I,
90
+ ):
91
+ issues.append("Suggest inspecting recorded report checks and CSVs, not unverified model redesign or data collection.")
92
+ if has_unresolved_verify_checks and re.search(
93
+ r"\b(?:all|every)\b[^.!?\n]{0,45}\bVERIFY\b[^.!?\n]{0,30}\bpass(?:ed|es)?\b|"
94
+ r"\bpass(?:ed|es)?\b[^.!?\n]{0,30}\b(?:all|every)\b[^.!?\n]{0,45}\bVERIFY\b",
95
+ text, re.I,
96
+ ):
97
+ issues.append("At least one VERIFY check is FAILED or UNCLEAR; not all checks passed.")
98
+ if re.search(
99
+ r"\b(?:more|most|highly|very)\s+(?:reliable|robust|stable|fiable|robusto|estable)\b|"
100
+ r"\b(?:stronger|better)\s+(?:model\s+)?stability\b",
101
+ text, re.I,
102
+ ):
103
+ issues.append("Reliability or model stability cannot be inferred from the score or R2 difference alone.")
104
+ return tuple(issues)