Example #1
0
    @staticmethod
    def __find_restaurant_action(user_id, props: dict, slots: Dict[Slot, str]):
        return FindRestaurantAction(user_id=user_id, props=props, slots=slots)

    @staticmethod
    def __search_by_tag_action(user_id, props: dict, slots: Dict[Slot, str]):
        return SearchByTagAction(user_id=user_id, props=props, slots=slots)

    @staticmethod
    def _get_car_rental(user_id, props: dict, slots: Dict[Slot, str]):
        return RentACarAction(user_id=user_id, props=props, slots=slots)

    @staticmethod
    def __get_public_transport(user_id, props: dict, slots: Dict[Slot, str]):
        return PublicTransportAction(user_id=user_id, props=props, slots=slots)

    @staticmethod
    def _get_default_response(user_id, props: dict, slots: Dict[Slot, str]):
        return DefaultAnswerAction(user_id=user_id, props=props, slots=slots)


if __name__ == '__main__':
    dm = DialogueManager()
    user_one, user_two = '1', '2'
    # print(dm.reply(user_one, TextQuery('about sbahn')))
    # print(dm.reply(user_one, TextQuery('rent a car')))
    # print(dm.reply(user_one, TextQuery('buy swarowski')))
    # print(dm.reply(user_one, TextQuery('find duty free')))

    print(dm.reply(user_one, TextQuery('fossil shop')))
Example #2
0
def send_text():
    text_query = TextQuery(request.get_json(force=True)['text'])
    dm_response = dm.reply(user_one, text_query).to_key_value_format()

    return jsonify(dm_response)
Example #3
0
                                                                       str]):
        return AboutCollectionObject(user_id=user_id, props=props, slots=slots)

    @staticmethod
    def _get_about_event(user_id, props: dict, slots: Dict[Slot, str]):
        return AboutEventAction(user_id=user_id, props=props, slots=slots)

    @staticmethod
    def _get_default_response(user_id, props: dict, slots: Dict[Slot, str]):
        return DefaultAnswerAction(user_id=user_id, props=props, slots=slots)


if __name__ == '__main__':
    dm = DialogueManager()
    user_one, user_two = '1', '2'
    print(dm.reply(user_one, TextQuery('привет')))
    # print(dm.reply(user_one, TextQuery('расскажи про Успение Богоматери')))
    print(dm.reply(user_one, TextQuery('расскажи про девочку на шаре')))
    # print(dm.reply(user_one, TextQuery('как попасть на выставку Русский Йорданс')))
    # print(dm.reply(user_one, TextQuery('когда будет лекция про искусство древней греции')))

    print(
        dm.reply(user_one,
                 TextQuery('как попасть в Искусство Древнего Египта?')))
    print(dm.reply(user_one, TextQuery('греческий дворик')))
    # print(dm.reply(user_one, TextQuery('да')))

    print(dm.reply(user_one, TextQuery('хочу узнать про пабло пикассо')))
    # print(dm.reply(user_one, TextQuery('расскажи про пушкина')))
    # print(dm.reply(user_one, TextQuery('как проехать до музея?')))
    # print(dm.reply(user_one, TextQuery('красная площадь')))
Example #4
0
 def activation_response(cls, initial_query: TextQuery,
                         slots: Dict[Slot, str]) -> ActivationResponse:
     for phrase in RouteAction.triggering_phrases:
         if phrase in initial_query.lower():
             return ActivationResponse(intent_detected=True)
Example #5
0
 def activation_response(cls, initial_query: TextQuery,
                         slots: Dict[Slot, str]) -> ActivationResponse:
     if initial_query.lower() in [
             'кто такой пушкин', 'расскажи про пушкина'
     ]:
         return ActivationResponse(intent_detected=True)
Example #6
0
 def activation_response(cls, initial_query: TextQuery,
                         slots: Dict[Slot, str]) -> ActivationResponse:
     if initial_query.lower() in ['hello', 'hi', 'welcome', 'wow']:
         return ActivationResponse(intent_detected=True)
Example #7
0
 def activation_response(cls, initial_query: TextQuery, slots: Dict[Slot, str]) -> ActivationResponse:
     if initial_query.lower() in ['привет', 'здорово', 'здравствуйте', 'хай']:
         return ActivationResponse(intent_detected=True)