Spaces:
Sleeping
Sleeping
Upload drift.py
Browse files- engine/drift.py +17 -16
engine/drift.py
CHANGED
|
@@ -107,51 +107,52 @@ def generate_teaching_note(state, student_response, mode, persona=None):
|
|
| 107 |
|
| 108 |
# Question quality - literary analysis focused
|
| 109 |
if any(word in response_lower for word in ["why did you", "why do you", "why are you"]):
|
| 110 |
-
notes.append("π
|
| 111 |
|
| 112 |
if any(word in response_lower for word in ["should", "need to", "have to"]):
|
| 113 |
-
notes.append("π
|
| 114 |
|
| 115 |
if response_lower.count("?") > 2:
|
| 116 |
-
notes.append("π―
|
| 117 |
|
| 118 |
# Question depth - connect to literary concepts
|
| 119 |
if len(student_response.split()) < 8:
|
| 120 |
if author and title:
|
| 121 |
-
notes.append(f"π
|
| 122 |
else:
|
| 123 |
-
notes.append("π
|
| 124 |
|
| 125 |
if any(phrase in response_lower for phrase in ["tell me about", "tell me more", "what's that like", "how do you feel"]):
|
| 126 |
-
notes.append("β
|
| 127 |
|
| 128 |
if any(word in response_lower for word in ["symbol", "represent", "meaning", "theme"]):
|
| 129 |
-
notes.append("π
|
| 130 |
|
| 131 |
# Character engagement - literary context
|
| 132 |
if mode == "triggered" and state.get("trust", 0) < 0.4:
|
| 133 |
if author:
|
| 134 |
-
notes.append(f"β οΈ
|
| 135 |
else:
|
| 136 |
-
notes.append("β οΈ
|
| 137 |
|
| 138 |
if mode == "trusting" and state.get("anxiety", 0) > 0.6:
|
| 139 |
-
notes.append("β¨
|
| 140 |
|
| 141 |
if mode == "decompensating":
|
| 142 |
-
notes.append("π
|
| 143 |
|
| 144 |
if mode == "recovering":
|
| 145 |
-
notes.append("π
|
| 146 |
|
| 147 |
# Add literary context based on specific terms used
|
| 148 |
if any(word in response_lower for word in ["choice", "decision", "decide"]):
|
| 149 |
-
notes.append("π‘
|
| 150 |
|
| 151 |
if any(word in response_lower for word in ["family", "mother", "father", "parent", "sister", "brother"]):
|
| 152 |
-
notes.append("π¨βπ©βπ§
|
| 153 |
|
| 154 |
if not notes:
|
| 155 |
-
notes.append("β
|
| 156 |
|
| 157 |
-
|
|
|
|
|
|
| 107 |
|
| 108 |
# Question quality - literary analysis focused
|
| 109 |
if any(word in response_lower for word in ["why did you", "why do you", "why are you"]):
|
| 110 |
+
notes.append("π <strong style='color: #2d3748;'>Literary Technique</strong>: 'Why' questions can sound accusatory. Consider using 'what' or 'how' to explore motivations more naturally (e.g., 'What were you thinking when...' or 'How did that moment feel?')")
|
| 111 |
|
| 112 |
if any(word in response_lower for word in ["should", "need to", "have to"]):
|
| 113 |
+
notes.append("π <strong style='color: #2d3748;'>Character Analysis Tip</strong>: Avoid directive language like 'should' - it judges the character. Instead, explore their perspective: 'What other choices did you consider?' This reveals internal conflict.")
|
| 114 |
|
| 115 |
if response_lower.count("?") > 2:
|
| 116 |
+
notes.append("π― <strong style='color: #2d3748;'>Focus Your Inquiry</strong>: Multiple questions can overwhelm. Pick your most important question for deeper exploration of theme, motivation, or symbolism.")
|
| 117 |
|
| 118 |
# Question depth - connect to literary concepts
|
| 119 |
if len(student_response.split()) < 8:
|
| 120 |
if author and title:
|
| 121 |
+
notes.append(f"π <strong style='color: #2d3748;'>Add Textual Context</strong>: Reference specific moments from '{title}' to ground your question. Connect to scenes, relationships, or conflicts from {author}'s narrative.")
|
| 122 |
else:
|
| 123 |
+
notes.append("π <strong style='color: #2d3748;'>Add Textual Context</strong>: Reference specific moments from the story to ground your question in the character's actual experiences.")
|
| 124 |
|
| 125 |
if any(phrase in response_lower for phrase in ["tell me about", "tell me more", "what's that like", "how do you feel"]):
|
| 126 |
+
notes.append("β
<strong style='color: #2d3748;'>Strong Question</strong>: Open-ended questions like this encourage the character to reveal subtext, internal conflict, and thematic depth. This is effective literary analysis.")
|
| 127 |
|
| 128 |
if any(word in response_lower for word in ["symbol", "represent", "meaning", "theme"]):
|
| 129 |
+
notes.append("π <strong style='color: #2d3748;'>Excellent</strong>: You're connecting character experience to broader literary themes. This kind of analysis reveals how authors use character to explore universal ideas.")
|
| 130 |
|
| 131 |
# Character engagement - literary context
|
| 132 |
if mode == "triggered" and state.get("trust", 0) < 0.4:
|
| 133 |
if author:
|
| 134 |
+
notes.append(f"β οΈ <strong style='color: #2d3748;'>Character Defensive</strong>: Notice how {char_name} withdraws when challenged - this mirrors how {author} shows psychological realism. Try questions that validate their experience first.")
|
| 135 |
else:
|
| 136 |
+
notes.append("β οΈ <strong style='color: #2d3748;'>Character Defensive</strong>: The character is withdrawing. Try questions that validate their experience before probing deeper.")
|
| 137 |
|
| 138 |
if mode == "trusting" and state.get("anxiety", 0) > 0.6:
|
| 139 |
+
notes.append("β¨ <strong style='color: #2d3748;'>Key Moment</strong>: The character is vulnerable right now - this is where authors reveal crucial backstory and motivation. Press deeper into their fears and desires.")
|
| 140 |
|
| 141 |
if mode == "decompensating":
|
| 142 |
+
notes.append("π <strong style='color: #2d3748;'>Character State</strong>: The character is emotionally overwhelmed. In literary analysis, these breaking points often reveal theme. Consider: What does this breakdown tell us about the story's larger meaning?")
|
| 143 |
|
| 144 |
if mode == "recovering":
|
| 145 |
+
notes.append("π <strong style='color: #2d3748;'>Reflection Point</strong>: The character is stabilizing. Good time to ask: 'What have you learned?' or 'How have you changed?' - this reveals character development.")
|
| 146 |
|
| 147 |
# Add literary context based on specific terms used
|
| 148 |
if any(word in response_lower for word in ["choice", "decision", "decide"]):
|
| 149 |
+
notes.append("π‘ <strong style='color: #2d3748;'>Theme Connection</strong>: You're exploring agency and choice - a key theme in literature. How does paralysis or action define this character?")
|
| 150 |
|
| 151 |
if any(word in response_lower for word in ["family", "mother", "father", "parent", "sister", "brother"]):
|
| 152 |
+
notes.append("π¨βπ©βπ§ <strong style='color: #2d3748;'>Family Dynamics</strong>: You're examining how family obligations shape identity - analyze how the author uses familial duty to explore broader social constraints.")
|
| 153 |
|
| 154 |
if not notes:
|
| 155 |
+
notes.append("β
<strong style='color: #2d3748;'>Good Engagement</strong>: You're exploring the character thoughtfully. Consider connecting their responses to the story's central themes and conflicts.")
|
| 156 |
|
| 157 |
+
# Join notes with proper line breaks for HTML rendering
|
| 158 |
+
return "<br><br>".join(notes)
|