Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. # analysis the will from in message
  2. listener_will = self._intention_nlu.analysis(listener_response_message, self._current_intention.name)
  3.  
  4. # listener hang up
  5. if listener_will.get("hungup", False):
  6. current_listener_will = ("client_hungup", (True, None))
  7. self._finished = True
  8. return current_listener_will
  9.  
  10. # bot just says message as we had set, ignore message from listener.
  11. elif self._current_intention.is_focus_stream():
  12. self._current_intention.set_positive_will()
  13. _response_intention = self._current_intention.get_response_intention()
  14.  
  15. else:
  16. # listener is puzzled
  17. if listener_will['puzzled']:
  18. self._current_intention.set_puzzle_will()
  19. _response_intention = self._current_intention
  20. if self._current_intention.dont_understand_and_hungup():
  21. _response_intention = self._intention_tree.get_focus_stop_intention()
  22.  
  23. else:
  24. # listener ask an question
  25. if listener_will['other_intention']:
  26. other_intention_type = listener_will["other_intention_information"][0]
  27. qa_intention = self._intention_tree.get_intention(other_intention_type, focus_flag=False, copy_flag=True)
  28.  
  29. self._current_intention.insert_other_intenion(qa_intention)
  30. self._current_intention.set_other_will(qa_intention.intention_type)
  31.  
  32. # listener no respone and we need to wait for seconds.
  33. elif listener_will.get("waiting", False):
  34. current_listener_will = ("waiting", (True, None))
  35. return current_listener_will
  36.  
  37. else:
  38. # listener accept
  39. if listener_will['accepted']:
  40. self._current_intention.set_accepted_will()
  41. # listener refuse
  42. else:
  43. self._current_intention.set_refused_will()
  44.  
  45. # bot response
  46. _response_intention = self._current_intention.get_response_intention()
  47. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement