def test_get_mood_none(self): answer = NLG().make_answer({"move": "get_mood"}, "en", { "positive": 0, "negative": 0 }) self.assertIn(answer, ["Sorry, you don't remember you telling me anything"])
def test_next(self): self.assertIn(NLG().make_answer({"move": "next"}, "en"), [ "I am not super smart, I did't not understand you. " "But you can always ask me to explain what I can " "and cannot do for you", "I did not understand you this time", "sorry, what?" ])
def test_mood_positive(self): self.assertIn( NLG().make_answer({ "move": "mood", "mood": "positive" }, "en"), ["Nice to hear that!", "I'm happy for you!", "Great news!"])
def test_get_mood_some(self): answer = NLG().make_answer({"move": "get_mood"}, "en", { "positive": 50, "negative": 50 }) self.assertIn(answer, [ "From what you've told me you mood was 50% positive and 50% negative" ])
def get_response(message): print("got text message :", message["text"]) message = _prepare_message(message) if is_oz_message(message): return respond_oz_message(message) msg_parsed = NLU().parse(message, message["language"]) move = DialogManager().get_next_move(msg_parsed) print("detected move {move}".format(move=move["move"])) action = act_on_move(message, move) if move["move"] == "next" and is_oz_on(message): return log_to_oz(message) return NLG().make_answer(move, message["language"], action), move
def test_start(self): self.assertIn(NLG().make_answer({"move": "start"}, "en"), [ "Hello!", "Hi there!", "What's up?", "Nice to see you!", "Hello dear!" ])
def test_mood_neutral(self): self.assertIn( NLG().make_answer({ "move": "mood", "mood": "neutral" }, "en"), ["I got it", "I see", "OK"])
def test_mood_negative(self): self.assertIn( NLG().make_answer({ "move": "mood", "mood": "negative" }, "en"), ["What a pity", "I'm sorry to hear that.", "So sad."])