DronA23 commited on
Commit
7fd2dc9
·
verified ·
1 Parent(s): a2f3707

Create dialogue.py

Browse files
Files changed (1) hide show
  1. dialogue.py +22 -0
dialogue.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from typing import Tuple, List
3
+
4
+ KEYWORD = "housing price"
5
+ Clarifications = (
6
+ "Housing price is continuous: would you like to\n"
7
+ "1) bin it into categories & use logistic regression?\n"
8
+ "2) switch to linear regression?"
9
+ )
10
+
11
+ def handle_message(message: str, history: List[Tuple[str, str]]) -> Tuple[str, List[Tuple[str, str]]]:
12
+ msg_lower = message.lower()
13
+ if KEYWORD in msg_lower and "logistic regression" in msg_lower:
14
+ return Clarifications, history
15
+ if "linear regression" in msg_lower:
16
+ reply = "Great, calling linear regression now..."
17
+ return reply, history + [(message, reply)]
18
+ if "bin" in msg_lower or "classifier" in msg_lower:
19
+ reply = "Understood, building classifier with binned targets..."
20
+ return reply, history + [(message, reply)]
21
+ from helper import generate_reply
22
+ return generate_reply(message, history)