Пример #1
0
    def create():
        from dialog.schema.factories.inputs import AfterSearchResults

        return Output(
            _id=AnythingElseCanHelpWith.__id(),
            prompt=Prompt(
                items=["Is there anything else I can help you with?"]
            ),
            children=[
                GetUserInput(
                    children=[
                        Input(
                            Grammar(
                                watson_items=[
                                    "Go back",
                                    "$ go back",
                                    "$ wait",
                                    "$ not done",
                                    "$ not finished"
                                ]
                            ),
                            children=[
                                Output(
                                    GenericPrompt.ok(),
                                    children=[AfterSearchResults.goto()]
                                )
                            ]
                        ),
                        Input(
                            GenericGrammar.yes(),
                            children=[
                                RequestSuccessAction.set_to_blank(),
                                TerminalExchangeAction.set_to_blank(),
                                TopicAction.set_to_blank(),
                                StylePreferenceAction.set_to_blank(),
                                ColorPreferenceAction.set_to_blank(),
                                RecencyPreferenceAction.set_to_blank()
                            ]
                        ),
                        Input(
                            GenericGrammar.no(),
                            children=[
                                Output(
                                    GenericGrammar.ok(),
                                    children=[Goto(ref="output_did_find_what_looking_for")]
                                )
                            ]
                        ),
                        Goto(ref="input_2456878")
                    ]

                )
            ]
        )
Пример #2
0
 def create():
     return Input(
         grammar=Grammar(
             watson_items=[
                 "all items",
                 "$ all items",
                 "$ all results"
             ]
         ),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             StylePreferenceAction.set_to_blank(),
             ColorPreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ]
     )
Пример #3
0
 def create():
     return Input(
         Grammar(
             watson_items=[
                 "Remove rating",
                 "$ remove (STYLE)={Style_Preference}",
                 "$ cancel (STYLE)={Style_Preference}",
                 "$ remove style",
                 "$ cancel style",
                 "$ all styles",
                 "$ all style",
                 "$ any styles",
                 "$ any style"
             ]
         ),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             StylePreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ]
     )
Пример #4
0
 def create():
     # Folder
     return Folder(
         label="SYSTEM INITIATED SEQUENCES",
         children=[
             Output(
                 _id=SystemInitiatedSequences.__id(),
                 prompt=Prompt(
                     items=["Is there anything else I can help you with?"]),
                 children=[
                     PageAction.set_to_new(),
                     Action(var_name="Current_Index",
                            operator="SET_TO",
                            text="0"),
                     ColorPreferenceAction.set_to_blank(),
                     # RecencyPreferenceAction.set_to_blank(),
                     StylePreferenceAction.set_to_blank(),
                     Action(var_name="Search_Now", operator="SET_TO_NO"),
                     Action(var_name="Terminal_Exchange",
                            operator="SET_TO_BLANK"),
                     Action(var_name="Topic", operator="SET_TO_BLANK"),
                     Action(var_name="ZIP_Code_Preference",
                            operator="SET_TO_BLANK"),
                     Action(var_name="Display_Trailer",
                            operator="SET_TO_NO"),
                     Action(var_name="Selected_Movie",
                            operator="SET_TO_BLANK"),
                     Action(var_name="Display_Movie_Details",
                            operator="SET_TO_NO"),
                     Action(var_name="Display_Reviews",
                            operator="SET_TO_NO"),
                     Action(var_name="Popularity_Score",
                            operator="SET_TO",
                            text="0.5"),
                     GetUserInput(children=[
                         Input(GenericGrammar.yes(),
                               children=[HowCanHelpYouOutput.goto()]),
                         Input(
                             GenericGrammar.no(),
                             children=[
                                 Output(
                                     prompt=GenericPrompt.ok(),
                                     children=[
                                         Goto(
                                             ref=
                                             "output_did_find_what_looking_for"
                                         )
                                     ])
                             ]),
                         PreliminarySequencesSearch.goto()
                     ])
                 ]),
             Output(
                 _id="output_did_find_what_looking_for",
                 prompt=Prompt(items=[
                     "Did you find what you were looking for, {User_Name}?"
                 ]),
                 children=[
                     GetUserInput(children=[
                         Input(
                             GenericGrammar().yes(),
                             children=[
                                 RequestSuccessAction.set_to_yes(),
                                 Output(
                                     prompt=Prompt(items=["Great!"]),
                                     children=[
                                         Output(
                                             _id="output_goodbye",
                                             prompt=Prompt(items=[
                                                 "Goodbye.<br> <br>"
                                             ]),
                                             children=[
                                                 TerminalExchangeAction.
                                                 set_to_yes(),
                                                 GreetingAction.reset(),
                                                 GetUserInput(children=[
                                                     Input(
                                                         Grammar(watson_items
                                                                 =[
                                                                     "Goodbye",
                                                                     "$ goodbye"
                                                                 ]),
                                                         children
                                                         =[
                                                             Output(
                                                                 _id=
                                                                 "output_end_of_conversation",
                                                                 prompt=
                                                                 Prompt(
                                                                     items
                                                                     ="&lt;i&gt;Say anything to continue.&lt;/i&gt;"
                                                                 ),
                                                                 children=[
                                                                     GetUserInput(children=[
                                                                         Output(
                                                                             _id
                                                                             ="output_welcome_back",
                                                                             prompt
                                                                             =Prompt(
                                                                                 items
                                                                                 =[
                                                                                     "Welcome back!"
                                                                                 ]
                                                                             ),
                                                                             children
                                                                             =[
                                                                                 HowCanHelpYouOutput
                                                                                 .
                                                                                 goto(
                                                                                 )
                                                                             ]
                                                                         )
                                                                     ])
                                                                 ]),
                                                         ]),
                                                     HowCanHelpYouOutput.
                                                     goto()
                                                 ])
                                             ])
                                     ])
                             ]),
                         Input(
                             GenericGrammar.no(),
                             children=[
                                 RequestSuccessAction.set_to_no(),
                                 Output(
                                     prompt=Prompt(
                                         items=[
                                             "Oh no. Do you want to try again?"
                                         ]),
                                     children=[
                                         GetUserInput(children=[
                                             Input(
                                                 GenericGrammar.no(),
                                                 children=
                                                 [
                                                     TerminalExchangeAction.
                                                     set_to_no(),
                                                     Output(
                                                         prompt
                                                         =GenericPrompt.ok(
                                                         ),
                                                         children=[
                                                             Goto(ref=
                                                                  "output_goodbye"
                                                                  )
                                                         ])
                                                 ]),
                                             Input(
                                                 GenericGrammar.yes(),
                                                 children=[
                                                     Output(prompt=Prompt(
                                                         items=[
                                                             "Okay. What can I do for you?"
                                                         ]),
                                                            children=[
                                                                Goto(
                                                                    "getUserInput_how_can_i_help_you"
                                                                )
                                                            ])
                                                 ])
                                         ])
                                     ])
                             ]),
                         PreliminarySequencesSearch.goto()
                     ])
                 ]),
             Output(
                 _id="output_too_much_small_talk",
                 prompt=Prompt(items=[
                     "This is fun, but wouldn't you like to look up some movies?"
                 ]),
                 children=[
                     GetUserInput(children=[
                         Input(
                             GenericGrammar.yes(),
                             children=[StylePreferenceProfileCheck.goto()]),
                         Input(GenericGrammar.no(),
                               children=[
                                   SmallTalkAction.set_to_zero(),
                                   Output(GenericPrompt.ok_fine())
                               ]),
                         Input(
                             GenericGrammar.ok(),
                             children=[StylePreferenceProfileCheck.goto()]),
                         PreliminarySequencesSearch.goto()
                     ])
                 ])
         ])
Пример #5
0
 def create():
     return Input(
         _id="input_main_search_criteria",
         grammar=Grammar(
             watson_items=[
                 "Movies",
                 "$ (COLOR)={Color_Preference}",
                 "$ (STYLE)={Style_Preference}",
                 # "$ movies"
             ]
         ),
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             TopicAction.set_to_shoes(),
             ColorPreferenceAction.set_to_value(),
             StylePreferenceAction.set_to_value(),
             # DateTimeInput.create(),
             # CertificationPreferenceInput.create(),
             # FamilyFriendlyInput.create(),
             ColorPreferenceInput.create(StylePreferenceInput.goto()),
             StylePreferenceInput.create(Goto(ref="out_of_scope_topics")),
             # ZipcodeInput.create(),
             Input(
                 _id="out_of_scope_topics",
                 grammar=Grammar(
                     watson_items=[
                         "out-of-scope movie topics",
                         "$ (OTHER_MOVIE)={Topic}"
                     ]
                 ),
                 children=[
                     TopicAction.set_to_value(),
                     Goto(ref="output_no_topic_lookup")
                 ]
             ),
             StylePreferenceProfileCheck.create(),
             # GenrePreferenceProfileCheck.create(),
             ColorPreferenceProfileCheck.create(),
             Output(
                 _id="output_ok_do_search",
                 prompt=GenericPrompt.ok(),
                 children=[
                     Output(
                         _id="output_search_now",
                         prompt=Prompt(
                             items=["Search_Now"]
                         ),
                         children=[
                             Action(var_name="Last_Results", operator="SET_TO_NO"),
                             Action(var_name="First_Results", operator="SET_TO_NO"),
                             Action(var_name="Search_Now", operator="SET_TO_YES"),
                             Action(var_name="First_Time", operator="SET_TO_NO"),
                             Input(
                                 Grammar(
                                     watson_items=["UPDATE NUM_MOVIES"]
                                 ),
                                 children=[
                                     If(
                                         elements=[
                                             ResultsCountConditions.equals_zero(),
                                             Output(
                                                 Prompt(
                                                     items=[
                                                         "I'm afraid I found {%s} matching {Color_Preference} {Style_Preference}. Try changing your criteria." % NAME_RESULTS_COUNT]
                                                 ),
                                                 children=[
                                                     GetUserInput(
                                                         children=[
                                                             Input(
                                                                 GenericGrammar.ok(),
                                                                 children=[
                                                                     ColorPreferenceAction.set_to_blank(),
                                                                     StylePreferenceAction.set_to_blank(),
                                                                     StylePreferenceProfileCheck.goto(),
                                                                     RemoveColorInput.goto()
                                                                 ]
                                                             ),
                                                             RemoveColorInput.goto()
                                                         ]
                                                     )
                                                 ]
                                             )
                                         ]
                                     ),
                                     If(
                                         elements=[
                                             StyleConditions.is_blank(),
                                             ColorConditions.has_value(),
                                             Output(
                                                 Prompt(
                                                     items=[
                                                         "Good choice, {User_Name}! I found {%s} results for {Recency_Preference} {Color_Preference}-rated movies." % NAME_RESULTS_COUNT]
                                                 ),
                                                 children=[AfterSearchResults.goto()]
                                             )
                                         ]
                                     ),
                                     If(
                                         elements=[
                                             ColorConditions.is_blank(),
                                             StyleConditions.has_value(),
                                             Output(
                                                 Prompt(
                                                     items=[
                                                         "Good choice, {User_Name}! I found {%s} results for {Color_Preference} {Style_Preference} movies." % NAME_RESULTS_COUNT]
                                                 ),
                                                 children=[AfterSearchResults.goto()]
                                             )
                                         ]
                                     ),
                                     If(
                                         elements=[
                                             ColorConditions.is_blank(),
                                             StyleConditions.is_blank(),
                                             Output(
                                                 Prompt(
                                                     items=[
                                                         "I found {%s} results for ALL {Recency_Preference} movies." % NAME_RESULTS_COUNT]
                                                 ),
                                                 children=[AfterSearchResults.goto()]
                                             )
                                         ]
                                     ),
                                     Output(
                                         Prompt(
                                             items=[
                                                 "Good choices, {User_Name}! I found {%s} results for {Color_Preference} {Style_Preference} movies." % NAME_RESULTS_COUNT]
                                         ),
                                         children=[AfterSearchResults.create()]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
Пример #6
0
    def create():
        # Folder
        return Folder(
            label="SYSTEM INITIATED SEQUENCES",
            children=[
                Output(
                    _id=SystemInitiatedSequences.__id(),
                    prompt=Prompt(
                        items=["Is there anything else I can help you with?"]
                    ),
                    children=[
                        PageAction.set_to_new(),
                        Action(var_name="Current_Index", operator="SET_TO", text="0"),
                        ColorPreferenceAction.set_to_blank(),
                        # RecencyPreferenceAction.set_to_blank(),
                        StylePreferenceAction.set_to_blank(),
                        Action(var_name="Search_Now", operator="SET_TO_NO"),
                        Action(var_name="Terminal_Exchange", operator="SET_TO_BLANK"),
                        Action(var_name="Topic", operator="SET_TO_BLANK"),
                        Action(var_name="ZIP_Code_Preference", operator="SET_TO_BLANK"),
                        Action(var_name="Display_Trailer", operator="SET_TO_NO"),
                        Action(var_name="Selected_Movie", operator="SET_TO_BLANK"),
                        Action(var_name="Display_Movie_Details", operator="SET_TO_NO"),
                        Action(var_name="Display_Reviews", operator="SET_TO_NO"),
                        Action(var_name="Popularity_Score", operator="SET_TO", text="0.5"),
                        GetUserInput(
                            children=[
                                Input(
                                    GenericGrammar.yes(),
                                    children=[HowCanHelpYouOutput.goto()]
                                ),
                                Input(
                                    GenericGrammar.no(),
                                    children=[
                                        Output(
                                            prompt=GenericPrompt.ok(),
                                            children=[Goto(ref="output_did_find_what_looking_for")]
                                        )
                                    ]
                                ),
                                PreliminarySequencesSearch.goto()
                            ]
                        )
                    ]
                ),
                Output(
                    _id="output_did_find_what_looking_for",
                    prompt=Prompt(
                        items=["Did you find what you were looking for, {User_Name}?"]
                    ),
                    children=[
                        GetUserInput(
                            children=[
                                Input(
                                    GenericGrammar().yes(),
                                    children=[
                                        RequestSuccessAction.set_to_yes(),
                                        Output(
                                            prompt=Prompt(
                                                items=["Great!"]
                                            ),
                                            children=[
                                                Output(
                                                    _id="output_goodbye",
                                                    prompt=Prompt(
                                                        items=["Goodbye.<br> <br>"]
                                                    ),
                                                    children=[
                                                        TerminalExchangeAction.set_to_yes(),
                                                        GreetingAction.reset(),
                                                        GetUserInput(
                                                            children=[
                                                                Input(
                                                                    Grammar(
                                                                        watson_items=[
                                                                            "Goodbye",
                                                                            "$ goodbye"
                                                                        ]
                                                                    ),
                                                                    children=[
                                                                        Output(
                                                                            _id="output_end_of_conversation",
                                                                            prompt=Prompt(
                                                                                items="&lt;i&gt;Say anything to continue.&lt;/i&gt;"
                                                                            ),
                                                                            children=[
                                                                                GetUserInput(
                                                                                    children=[
                                                                                        Output(
                                                                                            _id="output_welcome_back",
                                                                                            prompt=Prompt(
                                                                                                items=[
                                                                                                    "Welcome back!"]
                                                                                            ),
                                                                                            children=[
                                                                                                HowCanHelpYouOutput.goto()]
                                                                                        )
                                                                                    ]
                                                                                )
                                                                            ]
                                                                        ),

                                                                    ]
                                                                ),
                                                                HowCanHelpYouOutput.goto()
                                                            ]
                                                        )
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                ),
                                Input(
                                    GenericGrammar.no(),
                                    children=[
                                        RequestSuccessAction.set_to_no(),
                                        Output(
                                            prompt=Prompt(
                                                items=["Oh no. Do you want to try again?"]
                                            ),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            GenericGrammar.no(),
                                                            children=[
                                                                TerminalExchangeAction.set_to_no(),
                                                                Output(
                                                                    prompt=GenericPrompt.ok(),
                                                                    children=[Goto(
                                                                        ref="output_goodbye")]
                                                                )
                                                            ]
                                                        ),
                                                        Input(
                                                            GenericGrammar.yes(),
                                                            children=[
                                                                Output(
                                                                    prompt=Prompt(
                                                                        items=[
                                                                            "Okay. What can I do for you?"]
                                                                    ),
                                                                    children=[
                                                                        Goto(
                                                                            "getUserInput_how_can_i_help_you")
                                                                    ]
                                                                )
                                                            ]
                                                        )
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                ),
                                PreliminarySequencesSearch.goto()
                            ]
                        )
                    ]
                ),
                Output(
                    _id="output_too_much_small_talk",
                    prompt=Prompt(
                        items=["This is fun, but wouldn't you like to look up some movies?"]
                    ),
                    children=[
                        GetUserInput(
                            children=[
                                Input(
                                    GenericGrammar.yes(),
                                    children=[
                                        StylePreferenceProfileCheck.goto()
                                    ]
                                ),
                                Input(
                                    GenericGrammar.no(),
                                    children=[
                                        SmallTalkAction.set_to_zero(),
                                        Output(
                                            GenericPrompt.ok_fine()
                                        )
                                    ]
                                ),
                                Input(
                                    GenericGrammar.ok(),
                                    children=[
                                        StylePreferenceProfileCheck.goto()
                                    ]
                                ),
                                PreliminarySequencesSearch.goto()
                            ]
                        )
                    ]
                )
            ]
        )