Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # analysis the will from in message
- listener_will = self._intention_nlu.analysis(listener_response_message, self._current_intention.name)
- # listener hang up
- if listener_will.get("hungup", False):
- current_listener_will = ("client_hungup", (True, None))
- self._finished = True
- return current_listener_will
- # bot just says message as we had set, ignore message from listener.
- elif self._current_intention.is_focus_stream():
- self._current_intention.set_positive_will()
- _response_intention = self._current_intention.get_response_intention()
- else:
- # listener is puzzled
- if listener_will['puzzled']:
- self._current_intention.set_puzzle_will()
- _response_intention = self._current_intention
- if self._current_intention.dont_understand_and_hungup():
- _response_intention = self._intention_tree.get_focus_stop_intention()
- else:
- # listener ask an question
- if listener_will['other_intention']:
- other_intention_type = listener_will["other_intention_information"][0]
- qa_intention = self._intention_tree.get_intention(other_intention_type, focus_flag=False, copy_flag=True)
- self._current_intention.insert_other_intenion(qa_intention)
- self._current_intention.set_other_will(qa_intention.intention_type)
- # listener no respone and we need to wait for seconds.
- elif listener_will.get("waiting", False):
- current_listener_will = ("waiting", (True, None))
- return current_listener_will
- else:
- # listener accept
- if listener_will['accepted']:
- self._current_intention.set_accepted_will()
- # listener refuse
- else:
- self._current_intention.set_refused_will()
- # bot response
- _response_intention = self._current_intention.get_response_intention()
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement