j-js commited on
Commit
4e8eb94
·
verified ·
1 Parent(s): ac829fc

Update conversation_logic.py

Browse files
Files changed (1) hide show
  1. conversation_logic.py +32 -19
conversation_logic.py CHANGED
@@ -173,25 +173,38 @@ def _looks_like_question_text(text: str) -> bool:
173
 
174
 
175
  def _is_topic_query(text: str) -> bool:
176
- low = _clean_text(text).lower()
177
- if not low:
178
- return False
179
- return any(
180
- phrase in low
181
- for phrase in [
182
- "what topic is this question",
183
- "what topic is this",
184
- "what is the topic of this question",
185
- "what type of question is this",
186
- "what kind of question is this",
187
- "what area is this",
188
- "what concept is this",
189
- "what concept is this testing",
190
- "what skill is this testing",
191
- "identify the topic",
192
- "identify the concept",
193
- ]
194
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
 
197
  def _specific_topic_from_question(question_text: str, fallback_topic: str, classified_topic: str) -> str:
 
173
 
174
 
175
  def _is_topic_query(text: str) -> bool:
176
+ low = (text or "").strip().lower()
177
+
178
+ exact_patterns = [
179
+ "what topic is this question",
180
+ "what topic is this",
181
+ "what is the topic",
182
+ "what type of question is this",
183
+ "what kind of question is this",
184
+ "what area is this",
185
+ "what is this testing",
186
+ "what skill is this testing",
187
+ "what concept is this testing",
188
+ "identify the topic",
189
+ "identify the type of question",
190
+ ]
191
+ if any(p in low for p in exact_patterns):
192
+ return True
193
+
194
+ # shorter / looser phrasing
195
+ if "topic" in low and "this" in low:
196
+ return True
197
+
198
+ if "testing" in low and "this" in low:
199
+ return True
200
+
201
+ if "type" in low and "question" in low:
202
+ return True
203
+
204
+ if "kind" in low and "question" in low:
205
+ return True
206
+
207
+ return False
208
 
209
 
210
  def _specific_topic_from_question(question_text: str, fallback_topic: str, classified_topic: str) -> str: