File size: 7,880 Bytes
e53f10b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
"""
Education-grounded regex patterns for planning / monitoring.

Based on:
  - Schraw & Moshman (1995): metacognitive regulation = planning + monitoring + evaluation
  - Artzt & Armour-Thomas (1992): orientation / organization / execution / verification
  - Nelson & Narens (1990): meta-level monitoring of object-level cognition
  - Schraw (1998): planning = strategy selection; monitoring = real-time regulation

Key design principle:
  Triggers must be METACOGNITIVE discourse ("I will use X approach"),
  not COGNITIVE execution ("let x = 5"). The former is planning, the latter is representation.
"""


# ============================================================
# MONITORING — real-time meta-level awareness of execution
# ============================================================
MONITORING_PATTERNS = {

    # M1. Error Detection (Schraw debugging)
    "error_detection": [
        r"(?i)\bwait[,.]?\s",
        r"(?i)\bactually[,.]?\s",
        r"(?i)\bno[,.]?\s+(wait|that'?s|hold|i\s+think)",
        r"(?i)\bhmm[,.]?\s",
        r"(?i)\bhold\s+on[,.]?\s",
        r"(?i)\bi\s+(made|have)\s+a?\s*(mistake|error|typo|miscalculation)",
        r"(?i)\bthat'?s?\s+(not\s+right|wrong|incorrect|off)\b",
        r"(?i)\bi\s+(mis-?(calculated|counted|read|understood|interpreted|applied))",
        r"(?i)\bsomething'?s?\s+(off|wrong|not\s+right)\b",
    ],

    # M2. Comprehension Monitoring (Nelson & Narens)
    "comprehension_monitoring": [
        r"(?i)\blet\s+me\s+(check|verify|confirm|double[- ]?check|validate|make\s+sure)\b",
        r"(?i)\blet\s+me\s+re-?read\s+the\s+problem\b",
        r"(?i)\bto\s+(verify|confirm|double-?check)\s+(this|that|my|the)\b",
        r"(?i)\bdoes\s+(this|that)\s+(make\s+sense|seem\s+right|look\s+correct)\?",
        r"(?i)\blet\s+me\s+make\s+sure\s+(this|that|i)\b",
        r"(?i)\bsanity\s+check\b",
        r"(?i)\bi\s+should\s+(check|verify|confirm)\s+(whether|that|if)\b",
        r"(?i)\bam\s+i\s+(doing\s+this\s+right|on\s+the\s+right\s+track|missing\s+something)\b",
    ],

    # M3. Progress Monitoring (Winne & Hadwin)
    "progress_monitoring": [
        r"(?i)\bso\s+far\s+(so\s+good|i\s+have|this\s+(seems|looks|is))\b",
        r"(?i)\bi'?ve\s+found\s+(that|the)\b",
        r"(?i)\bnow\s+i\s+(know|have|need|can)\b",
        r"(?i)\bthis\s+means\s+(that\s+)?i\s+(need|can|should|must)\b",
        r"(?i)\bso\s+the\s+(answer|result|value)\s+(should|must|will)\s+be\b",
        r"(?i)\bthat\s+doesn'?t\s+(work|seem\s+right|make\s+sense)\b",
        r"(?i)\bthis\s+(approach|method|strategy|path)\s+(isn'?t|doesn'?t|won'?t)\s+work\b",
        r"(?i)\bi'?m\s+(stuck|not\s+sure|not\s+getting\s+anywhere|going\s+in\s+circles)\b",
    ],

    # M4. Strategy Re-evaluation (Artzt verification)
    "strategy_reeval": [
        r"(?i)\blet\s+me\s+(reconsider|rethink|redo|re-?examine|go\s+back|start\s+over)\b",
        r"(?i)\blet\s+me\s+try\s+(a\s+)?different\b",
        r"(?i)\b(try|use|take)\s+(a\s+)?(different|another|alternative)\s+(approach|method|way|angle)\b",
        r"(?i)\banother\s+(way|approach|method)\s+(to|would\s+be|is)\b",
        r"(?i)\bi\s+should\s+(go\s+back|reconsider|try\s+again|start\s+over)\b",
        r"(?i)\balternatively[,.]\s",
        r"(?i)\binstead[,.]\s+(let\s+me|i\s+will|i\s+can|i\s+should)\b",
    ],

    # M5. Result Verification (IRIS Vanderbilt)
    "result_verification": [
        r"(?i)\bsubstitut(e|ing)\s+(back|into|this)\b",
        r"(?i)\bplug(ging)?\s+(this|back|in|into)\b",
        r"(?i)\bcheck(ing)?\s+by\s+(substitut|plug|replac)\w+\b",
        r"(?i)\blet\s+me\s+check\s+(my|the)\s+(answer|result|work|computation|calculation)\b",
        r"(?i)\b(the|my)\s+answer\s+(should|must)\s+(satisfy|give|yield)\b",
    ],
}


# ============================================================
# PLANNING — conscious pre-execution strategy discourse
# ============================================================
PLANNING_PATTERNS = {

    # P1. Problem Orientation (Artzt orientation phase)
    "problem_orientation": [
        r"(?i)\bthis\s+is\s+a\s+(type\s+of\s+)?(problem\s+about|question\s+about)\b",
        r"(?i)\bthe\s+problem\s+(is\s+asking|wants|requires)\s+(us|me|to)\b",
        r"(?i)\bwe\s+need\s+to\s+find\b",
        r"(?i)\bthe\s+(goal|objective|target)\s+is\s+to\b",
        r"(?i)\bwhat\s+(we\s+|i\s+)?need\s+(here|is)\s+(is|a|to)\b",
        r"(?i)\bthis\s+looks\s+like\s+a\s+\w+\s+problem\b",
        r"(?i)\bi\s+(recognize|see|notice)\s+this\s+(is|as)\s+a?\s*\w+\b",
    ],

    # P2. Strategy Declaration (Schraw strategy selection)
    "strategy_declaration": [
        r"(?i)\bmy\s+(plan|approach|strategy|idea)\s+is\s+(to\s+)?\b",
        r"(?i)\bi\s+(will|am\s+going\s+to|plan\s+to|want\s+to)\s+(use|apply|try)\b",
        r"(?i)\bthe\s+(best|easiest|most\s+efficient)\s+(way|approach|strategy)\s+(here\s+)?is\s+to\b",
        r"(?i)\blet\s+me\s+(use|apply|employ|try)\s+(the\s+)?\w+\s+(method|theorem|formula|approach|technique)\b",
        r"(?i)\bi'?ll\s+(approach|tackle|solve|handle)\s+this\s+(by|using|with|via)\b",
        r"(?i)\busing\s+(the\s+)?(substitution|elimination|induction|contradiction|cases|graphing|factoring)\b",
        r"(?i)\bby\s+(induction|contradiction|cases|exhaustion|pigeonhole|construction)\b",
        r"(?i)\bproof\s+by\s+(induction|contradiction|cases|exhaustion|contrapositive)\b",
        r"(?i)\bwithout\s+loss\s+of\s+generality\b",
        r"(?i)\bwlog\b",
        r"(?i)\bworking?\s+backward(s)?\b",
        r"(?i)\bi'?ll\s+work\s+backward(s)?\b",
    ],

    # P3. Subgoal Decomposition (Veenman et al.)
    "subgoal_decomposition": [
        r"(?i)\blet\s+me\s+break\s+(this|it|the\s+problem)\s+(down|into|up)\b",
        r"(?i)\bto\s+solve\s+this[,.]\s+(i|we)\s+(will|need\s+to|should|must)\b",
        r"(?i)\bfirst[,.]\s+(i|we)\s+(need|should|will|must|have\s+to)\b",
        r"(?i)\bfirst[,.]\s+(let'?s|let\s+me)\b",
        r"(?i)\bhere'?s?\s+(my|the)\s+(plan|approach|strategy)\b",
        r"(?i)\bi'?ll\s+(do\s+this\s+in|break\s+this\s+into)\s+\w+\s+(steps|parts|stages)\b",
        r"(?i)\bthere\s+are\s+(two|three|four|several|a\s+few)\s+(steps|parts|things)\s+(to|we\s+need|i\s+need)\b",
        r"(?i)\bstep\s+1\s*[:.]",
        r"(?i)\bbefore\s+(solving|computing|doing|tackling)\s+\w+,\s*(i|we)\b",
    ],

    # P4. Case Analysis Declaration
    "case_analysis": [
        r"(?i)\bcase\s+(analysis|by\s+cases)\b",
        r"(?i)\bconsider\s+(the\s+)?(following\s+)?cases\b",
        r"(?i)\bi'?ll\s+consider\s+(two|three|several|the\s+following)\s+cases\b",
        r"(?i)\bthere\s+are\s+(two|three|several)\s+cases\s+to\s+consider\b",
        r"(?i)\bdepending\s+on\s+(whether|the\s+value)\b",
        r"(?i)\bwe\s+(distinguish|split\s+into|divide\s+into)\s+(two|three|the\s+following)\s+cases\b",
    ],

    # P5. Key Insight Identification (Schoenfeld)
    "key_insight": [
        r"(?i)\bthe\s+key\s+(insight|observation|idea|point|step)\s+(is|here\s+is)\b",
        r"(?i)\bthe\s+(trick|crucial\s+point|important\s+thing)\s+(is|here\s+is)\b",
        r"(?i)\bnotice\s+that\b",
        r"(?i)\bthe\s+key\s+(constraint|condition)\s+(is|here\s+is)\b",
        r"(?i)\bi\s+(observe|notice|realize|see)\s+that\b",
        r"(?i)\bthe\s+main\s+(challenge|difficulty)\s+is\b",
    ],
}


def flatten_patterns(d):
    """Flatten dict-of-lists into single list of regex strings."""
    return [p for ps in d.values() for p in ps]


def all_patterns(which="both"):
    """Return list of (dim, subtype, regex) tuples."""
    out = []
    if which in ("both", "monitoring"):
        for sub, ps in MONITORING_PATTERNS.items():
            for p in ps:
                out.append(("monitoring", sub, p))
    if which in ("both", "planning"):
        for sub, ps in PLANNING_PATTERNS.items():
            for p in ps:
                out.append(("planning", sub, p))
    return out