evolutia 0.1.2__py3-none-any.whl → 0.1.3__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.
@@ -1,16 +1,16 @@
1
- """
2
- Analizador de complejidad de ejercicios.
3
- Identifica tipo, pasos, conceptos y variables de ejercicios.
4
- """
5
- import re
6
- import logging
7
- from typing import Dict, List, Set, Optional, TYPE_CHECKING
8
- from collections import Counter
9
-
10
- if TYPE_CHECKING:
11
- from evolutia.cache.exercise_cache import ExerciseAnalysisCache
12
-
13
- logger = logging.getLogger(__name__)
1
+ """
2
+ Analizador de complejidad de ejercicios.
3
+ Identifica tipo, pasos, conceptos y variables de ejercicios.
4
+ """
5
+ import re
6
+ import logging
7
+ from typing import Dict, List, Set, Optional, TYPE_CHECKING
8
+ from collections import Counter
9
+
10
+ if TYPE_CHECKING:
11
+ from evolutia.cache.exercise_cache import ExerciseAnalysisCache
12
+
13
+ logger = logging.getLogger(__name__)
14
14
 
15
15
  try:
16
16
  from utils.math_extractor import (
@@ -28,19 +28,39 @@ except ImportError:
28
28
  )
29
29
 
30
30
 
31
- class ExerciseAnalyzer:
32
- """Analiza la complejidad y estructura de ejercicios."""
33
-
34
- def __init__(self, cache: Optional['ExerciseAnalysisCache'] = None):
35
- """
36
- Inicializa el analizador.
37
-
38
- Args:
39
- cache: Instancia opcional de ExerciseAnalysisCache para cachear análisis
40
- """
41
- pass
42
-
43
- self.cache = cache
31
+ class ExerciseAnalyzer:
32
+ """Analiza la complejidad y estructura de ejercicios."""
33
+
34
+ TYPE_PATTERNS = {
35
+ 'demostracion': re.compile(r'(?i)(demuestre|pruebe|verifique|muestre|justifique|demostraci[oó]n)'),
36
+ 'calculo': re.compile(r'(?i)(calcule|halle|encuentre|resuelva|eval[uú]e|calcular|obtenga|determinar)'),
37
+ 'aplicacion': re.compile(r'(?i)(aplicaci[oó]n|problema|vida real|modelo|f[íi]sic[ao]|ingenier[íi]a|econom[íi]a|contexto)')
38
+ }
39
+
40
+ STEP_KEYWORDS_PATTERN = re.compile(
41
+ r'(?i)(primero|luego|despu[ée]s|finalmente|entonces|por lo tanto|conclusi[oó]n|paso|seguidamente)',
42
+ re.MULTILINE
43
+ )
44
+
45
+ CONCEPT_PATTERNS = {
46
+ 'integrals': [r'(?i)integral', r'\\int', r'\\iint', r'\\iiint', r'\\oint'],
47
+ 'derivatives': [r'(?i)derivada', r'\\frac{d}{d', r'\\[dp]artial', r'\''],
48
+ 'limits': [r'(?i)l[íi]mite', r'\\lim'],
49
+ 'series': [r'(?i)serie', r'(?i)sucesi[oó]n', r'\\sum', r'convergencia'],
50
+ 'vectors': [r'(?i)vector', r'\\vec', r'\\mathbf', r'producto punto', r'producto cruz'],
51
+ 'matrices': [r'(?i)matriz', r'(?i)determinante', r'\\begin{pmatrix}', r'\\begin{bmatrix}', r'autovalor'],
52
+ 'coordinate_systems': [r'(?i)coordenadas', r'(?i)polares', r'(?i)esf[ée]ricas', r'(?i)cil[íi]ndricas', r'jacobian[oa]'],
53
+ 'vector_operations': [r'(?i)gradiente', r'(?i)divergencia', r'(?i)rotacional', r'\\nabla', r'teorema de stokes', r'teorema de green', r'teorema de la divergencia']
54
+ }
55
+
56
+ def __init__(self, cache: Optional['ExerciseAnalysisCache'] = None):
57
+ """
58
+ Inicializa el analizador.
59
+
60
+ Args:
61
+ cache: Instancia opcional de ExerciseAnalysisCache para cachear análisis
62
+ """
63
+ self.cache = cache
44
64
 
45
65
  def identify_exercise_type(self, content: str) -> str:
46
66
  """
@@ -135,34 +155,34 @@ class ExerciseAnalyzer:
135
155
 
136
156
  return concepts
137
157
 
138
- def analyze(self, exercise: Dict[str, Optional[str]]) -> Dict[str, Optional[str | int | float | List[str]]]:
139
- """
140
- Analiza un ejercicio completo y retorna metadatos de complejidad.
141
-
142
- Args:
143
- exercise: Diccionario con información del ejercicio
144
- - 'content': Contenido del ejercicio
145
- - 'solution': Contenido de la solución (opcional)
146
-
147
- Returns:
148
- Diccionario con análisis de complejidad
149
- """
150
- content = exercise.get('content', '')
151
- solution = exercise.get('solution', '')
152
-
153
- # Intentar caché primero
154
- if self.cache:
155
- cached_analysis = self.cache.get(exercise)
156
- if cached_analysis:
157
- logger.info(f"[ExerciseAnalyzer] Análisis obtenido del caché para exercise={exercise.get('label', 'unknown')}")
158
- return cached_analysis['analysis']
159
-
160
- # Análisis normal (cache miss)
161
- if not content:
162
- return {}
163
-
164
- # Extraer expresiones matemáticas
165
- math_expressions = extract_math_expressions(content)
158
+ def analyze(self, exercise: Dict[str, Optional[str]]) -> Dict[str, Optional[str | int | float | List[str]]]:
159
+ """
160
+ Analiza un ejercicio completo y retorna metadatos de complejidad.
161
+
162
+ Args:
163
+ exercise: Diccionario con información del ejercicio
164
+ - 'content': Contenido del ejercicio
165
+ - 'solution': Contenido de la solución (opcional)
166
+
167
+ Returns:
168
+ Diccionario con análisis de complejidad
169
+ """
170
+ content = exercise.get('content', '')
171
+ solution = exercise.get('solution', '')
172
+
173
+ # Intentar caché primero
174
+ if self.cache:
175
+ cached_analysis = self.cache.get(exercise)
176
+ if cached_analysis:
177
+ logger.info(f"[ExerciseAnalyzer] Análisis obtenido del caché para exercise={exercise.get('label', 'unknown')}")
178
+ return cached_analysis['analysis']
179
+
180
+ # Análisis normal (cache miss)
181
+ if not content:
182
+ return {}
183
+
184
+ # Extraer expresiones matemáticas
185
+ math_expressions = extract_math_expressions(content)
166
186
  if solution:
167
187
  math_expressions.extend(extract_math_expressions(solution))
168
188
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolutia
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Sistema automatizado para generar preguntas de examen desafiantes basadas en materiales didácticos existentes
5
5
  Home-page: https://github.com/glacy/evolutIA
6
6
  Author: Gerardo Lacy-Mora
@@ -6,7 +6,7 @@ evolutia/config_manager.py,sha256=Cf_MQzUq-g5rQuJN_csKt9gJSwPJ6kYg-Dw8uYp1um0,91
6
6
  evolutia/evolutia_engine.py,sha256=PDpXPydffrQfT_VUX4BYyW2jqKFIUbO0QVQARk76Yp8,22351
7
7
  evolutia/exam_generator.py,sha256=7CKdo86u8bC6yYJY7I3WITcyV_4L8lMRETngGYf2WbU,13837
8
8
  evolutia/exceptions.py,sha256=A1xnYmPlySYEeTHR12ct7Apet2n6JhGugjOYX4mmobw,779
9
- evolutia/exercise_analyzer.py,sha256=kGcjajxF2AynCTOuxQOweVa5Y3JqFTzyv8ZFDkzS-ts,7200
9
+ evolutia/exercise_analyzer.py,sha256=bY4c-hqeef_xrDTVC9X4MzZlglrhNejWtwEgI_NJ-Mw,8666
10
10
  evolutia/imports.py,sha256=CTsHJ5FukEKMh5GM_O9EsoH61F6xMGj_A3gV0H869Hc,5914
11
11
  evolutia/llm_providers.py,sha256=TMOVWv9kZcj5Ydp_nBvaJaEohjPdhHPmFPa-VHC2yJA,14955
12
12
  evolutia/material_extractor.py,sha256=CQGgCS9sRBNIhKeR2ya4V7TYBz47yWcEQdjpGEduZRY,12429
@@ -29,9 +29,9 @@ evolutia/utils/math_extractor.py,sha256=tKfzwnmj8Puw9w624bBAnRjgxr3my-O3a9UcIyi8
29
29
  evolutia/validation/__init__.py,sha256=q56nc4RekrPSuOAxJdogBMZHik8Lj69V2SyLD5DfRqg,40
30
30
  evolutia/validation/args_validator.py,sha256=lhlQ5_swUBYTO_7MXUgTgtwd_JLCCEjvh4YxM7KbtkE,10051
31
31
  evolutia/validation/config_validator.py,sha256=ATTI0--zZIG85WzASU59M2nW-nZbNSxWOe82QJ1vIMQ,20968
32
- evolutia-0.1.2.dist-info/licenses/LICENSE,sha256=jyOI5zt59oNBGE33KX2L1py7ZwWKqVFNcgEePR6o6YA,11564
33
- evolutia-0.1.2.dist-info/METADATA,sha256=iKHGOtSDC78nhpMcoGsnVJhnL8k6jxRtvujpAJHpfnA,16955
34
- evolutia-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- evolutia-0.1.2.dist-info/entry_points.txt,sha256=BMYhya9XcbrfsjGfp4lMVQF0TK3Bd_Kj6mZtFhVJ7zo,47
36
- evolutia-0.1.2.dist-info/top_level.txt,sha256=GrIvEW8qAI8CIW5XTPnCqC7o06qJIL8p9CGwVhCEC4s,22
37
- evolutia-0.1.2.dist-info/RECORD,,
32
+ evolutia-0.1.3.dist-info/licenses/LICENSE,sha256=jyOI5zt59oNBGE33KX2L1py7ZwWKqVFNcgEePR6o6YA,11564
33
+ evolutia-0.1.3.dist-info/METADATA,sha256=Vr_Zb7mokCyTSmcC-P0K25Zu0-NYWIqYcFMvBIsOT34,16955
34
+ evolutia-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
35
+ evolutia-0.1.3.dist-info/entry_points.txt,sha256=BMYhya9XcbrfsjGfp4lMVQF0TK3Bd_Kj6mZtFhVJ7zo,47
36
+ evolutia-0.1.3.dist-info/top_level.txt,sha256=GrIvEW8qAI8CIW5XTPnCqC7o06qJIL8p9CGwVhCEC4s,22
37
+ evolutia-0.1.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5