housebot / dialogue.py
DronA23's picture
Create dialogue.py
7fd2dc9 verified
raw
history blame contribute delete
888 Bytes
from typing import Tuple, List
KEYWORD = "housing price"
Clarifications = (
"Housing price is continuous: would you like to\n"
"1) bin it into categories & use logistic regression?\n"
"2) switch to linear regression?"
)
def handle_message(message: str, history: List[Tuple[str, str]]) -> Tuple[str, List[Tuple[str, str]]]:
msg_lower = message.lower()
if KEYWORD in msg_lower and "logistic regression" in msg_lower:
return Clarifications, history
if "linear regression" in msg_lower:
reply = "Great, calling linear regression now..."
return reply, history + [(message, reply)]
if "bin" in msg_lower or "classifier" in msg_lower:
reply = "Understood, building classifier with binned targets..."
return reply, history + [(message, reply)]
from helper import generate_reply
return generate_reply(message, history)