Ejemplo n.º 1
0
    def create():
        return Folder(
            label="Main",
            children=[
                Output(
                    prompt=GenericPrompt.what_is_your_name(),
                    children=[
                        GetUserInput(
                            children=[
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "Movies",
                                            "$ (Color)={Color_Preference}",
                                            "$ (Style)={Style_Preference}",
                                            "$ movies",
                                            "$ want to see something",
                                            "$ planning to go see",
                                            "$ planning to go to the",
                                            "$ going out to see",
                                            "$ planning to see",
                                            "$ want to go see",
                                            "$ thinking of seeing",
                                            "$ thinking we want to see",
                                            "$ what do you recommend",
                                            "$ can you recommend something",
                                            "$ what are your recommendations"
                                        ]
                                    ),
                                    children=[
                                        ColorPreferenceAction.set_to_value(),
                                        # CertificationPreferenceAction.set_to_value(),
                                        StylePreferenceAction.set_to_value(),
                                        TopicAction.set_to_shoes(),
                                        PreliminarySequencesSearch.goto()
                                    ]
                                ),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "Movie-related",
                                            "$ (OTHER_MOVIE)={Topic}",
                                            "$ (BY_OTHER_MOVIE)={Topic}",
                                            "$ showtimes",
                                            "$ theaters",
                                            "$ fandango",
                                            "$ reviews",
                                            "$ review",
                                            "$ critiques",
                                            "$ critique",
                                            "$ old movies",
                                            "$ classic movies",
                                            "$ oldies",
                                            "$ classics",
                                            "$ trailers",
                                            "$ reviews",
                                            "$ (DINING)={Topic}",
                                            "$ (WEATHER)={Topic}",
                                            "$ (TRAFFIC)={Topic}"
                                        ]
                                    ),
                                    children=[PreliminarySequencesSearch.goto()]
                                ),
                                Input(
                                    grammar=FeelingGrammar.create_preliminaries(),
                                    children=[

                                        PreliminarySequencesSearch.goto()
                                    ]
                                ),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "Why do you need to know?",
                                            "$ why",
                                            "$ need to know",
                                            "$ use it",
                                            "$ do with it"
                                        ]
                                    ),
                                    children=[
                                        Output(
                                            prompt=Prompt(
                                                items=["Just trying to be friendly."]
                                            ),
                                            children=[StartSearch.goto()]
                                        )
                                    ]
                                ),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "I don't want to give it!",
                                            "$ don't want",
                                            "$ no",
                                            "$ refuse",
                                            "$ none of your business"
                                        ]
                                    ),
                                    children=[
                                        Output(
                                            Prompt(items=["That's fine."]),
                                            children=[StartSearch.goto()]
                                        )
                                    ]
                                ),
                                Input(
                                    ProfileGrammar.create_my_name_is_dynamic_data(),
                                    children=[
                                        UserNameAction.set_to_source(),
                                        Output(
                                            prompt=Prompt(items=["Hi {User_Name}!"]),
                                            children=[StartSearch.goto()]
                                        )
                                    ],
                                    _id="input_user_knownas_name"
                                )
                            ],
                            _id="getUserInput_what_is_your_name"
                        ),
                        StartSearch.create(),
                        HowCanHelpYouOutput.create()
                    ],
                    _id="output_what_is_name"
                )
            ]
        )
Ejemplo n.º 2
0
 def create():
     return Folder(
             selection_type="RANDOM",
             label="OPENING SEQUENCES",
             children=[
                 Input(
                         GenericGrammar.create_hello(),
                         children=[
                             GreetingAction.create_increment(),
                             If(
                                     elements=[
                                         Condition(name=NAME_TERMINAL_EXCHANGE, operator="EQUAL_TO_YES"),
                                         Goto(ref="output_welcome_back")
                                     ]
                             ),
                             If(
                                     match_type="ANY",
                                     elements=[
                                         Condition(name=NAME_GREETING_COUNT, operator="GREATER_THEN", root_text="2"),
                                         Condition(name=NAME_SMALL_TALK_COUNT, operator="GREATER_THEN",
                                                   root_text="2"),
                                         Goto(ref="output_end_of_small_talk")
                                     ]
                             ),
                             Output(
                                     Prompt(
                                             items=[
                                                 "Hello.",
                                                 "Hi.",
                                                 "Hi there."
                                             ]
                                     ),
                                     children=[Output(
                                             _id="output_how_are_you",
                                             prompt=Prompt(
                                                     items=[
                                                         "How are you today?",
                                                         "How are you feeling today?",
                                                         "How is it going?"
                                                     ]
                                             ),
                                             children=[GetUserInput(
                                                     children=[
                                                         Input(
                                                                 Grammar(
                                                                         watson_items=[
                                                                             "Movies",
                                                                             "$ (STYLE)={Style_Preference}",
                                                                             "$ (COLOR)={Color_Preference}",
                                                                             "$ movies"
                                                                         ]
                                                                 ),
                                                                 children=[
                                                                     Goto(ref="input_main_search_criteria")
                                                                 ]
                                                         ),
                                                         Input(
                                                                 FeelingGrammar.create_not_so_good(),
                                                                 children=[
                                                                     Goto(ref="output_sorry_to_hear_that")
                                                                 ]
                                                         ),
                                                         Input(
                                                                 FeelingGrammar.create_not_so_bad(),
                                                                 children=[
                                                                     Goto(ref="output_good_to_hear")
                                                                 ]
                                                         ),
                                                         Input(
                                                                 FeelingGrammar.create_feeling_fine(),
                                                                 children=[
                                                                     Output(
                                                                             _id="output_good_to_hear",
                                                                             prompt=Prompt(
                                                                                     items=[
                                                                                         "Good to hear! <br> <br>"]
                                                                             ),
                                                                             children=[HowCanHelpYouOutput.goto()]
                                                                     )
                                                                 ]
                                                         ),
                                                         Input(
                                                                 FeelingGrammar.create_feeling_great(),
                                                                 children=[
                                                                     Output(
                                                                             Prompt(
                                                                                     items=[
                                                                                         "Fantastic! So glad to hear it. <br> <br>"]
                                                                             ),
                                                                             children=[HowCanHelpYouOutput.goto()]
                                                                     )
                                                                 ]
                                                         ),
                                                         Input(
                                                                 FeelingGrammar.create_feeling_bad(),
                                                                 children=[
                                                                     Output(
                                                                             _id="output_sorry_to_hear_that",
                                                                             prompt=Prompt(
                                                                                     items=[
                                                                                         "I'm sorry to hear that. <br> <br>"]
                                                                             ),
                                                                             children=[HowCanHelpYouOutput.goto()]
                                                                     )
                                                                 ]
                                                         ),
                                                         PreliminarySequencesSearch.goto()
                                                     ]
                                             )
                                             ]
                                     )]
                             )
                         ]
                 ),
                 Input(
                         Grammar(
                                 watson_items=[
                                     "How are you",
                                     "$ how have you been doing",
                                     "$ how is it going",
                                     "$ how are you",
                                     "$ what's shaking",
                                     "$ what's up"
                                 ]
                         ),
                         children=[
                             GreetingAction.create_increment(),
                             If(
                                     elements=[
                                         Condition(name=NAME_GREETING_COUNT, operator="GREATER_THEN", root_text="2"),
                                         Condition(name=NAME_SMALL_TALK_COUNT, operator="GREATER_THEN",
                                                   root_text="2"),
                                         Output(
                                                 _id="output_end_of_small_talk",
                                                 prompt=Prompt(
                                                         items=[
                                                             "You're very polite, but don't you want me to look up movies for you?"]
                                                 ),
                                                 children=[GetUserInput(
                                                         children=[
                                                             Input(
                                                                     GenericGrammar.yes(),
                                                                     children=[
                                                                         StylePreferenceProfileCheck.goto()
                                                                     ]
                                                             ),
                                                             Input(
                                                                     GenericGrammar.no(),
                                                                     children=[
                                                                         GreetingAction.reset(),
                                                                         Output(
                                                                                 GenericPrompt.ok_fine()
                                                                         )
                                                                     ]
                                                             ),
                                                             Input(
                                                                     GenericGrammar.ok(),
                                                                     children=[
                                                                         StylePreferenceProfileCheck.goto()
                                                                     ]
                                                             ),
                                                             PreliminarySequencesSearch.goto()
                                                         ]
                                                 )
                                                 ]
                                         )
                                     ]
                             ),
                             Input(
                                     Grammar(
                                             watson_items=[
                                                 "Fine",
                                                 "$ excellent",
                                                 "$ outstanding",
                                                 "$ fabulous",
                                                 "$ terrific",
                                                 "$ not good",
                                                 "$ not so good",
                                                 "$ not well",
                                                 "$ not so well",
                                                 "$ terrible",
                                                 "$ awful",
                                                 "$ worst",
                                                 "$ bored",
                                                 "$ sad",
                                                 "$ good",
                                                 "$ well",
                                                 "$ fine",
                                                 "$ thirsty",
                                                 "$ hungry",
                                                 "$ tired"
                                             ]
                                     ),
                                     children=[
                                         Output(
                                                 Prompt(items=["I am doing well, thanks."]),
                                                 children=[HowCanHelpYouOutput.goto()]
                                         )
                                     ]
                             ),
                             Output(
                                     Prompt(items=["I am doing well, thanks."]),
                                     children=[Goto(ref="output_how_are_you")]
                             )
                         ]
                 ),
                 Input(
                         Grammar(
                                 watson_items=[
                                     "Nice to meet you",
                                     "$ nice to meet you",
                                     "$ pleasure to meet you",
                                     "$ make your acquaintance"
                                 ]
                         ),
                         children=[
                             If(
                                     elements=[
                                         Condition(name="Greeting_Count", operator="GREATER_THEN", root_text="2"),
                                         Output(
                                                 Prompt(
                                                         items=[
                                                             "You're very polite, but don't you want me to look up movies for you?"]
                                                 ),
                                                 children=[GetUserInput(
                                                         children=[
                                                             Input(
                                                                     GenericGrammar.yes(),
                                                                     children=[
                                                                         StylePreferenceProfileCheck.goto()
                                                                     ]
                                                             ),
                                                             Input(
                                                                     GenericGrammar.no(),
                                                                     children=[
                                                                         GreetingAction.reset(),
                                                                         Output(
                                                                                 GenericPrompt.ok_fine()
                                                                         )
                                                                     ]
                                                             ),
                                                             Input(
                                                                     GenericGrammar.ok(),
                                                                     children=[
                                                                         StylePreferenceProfileCheck.goto()
                                                                     ]
                                                             ),
                                                             PreliminarySequencesSearch.goto()
                                                         ]
                                                 )
                                                 ]
                                         )
                                     ]
                             ),
                             Output(
                                     Prompt(items=["Nice to meet you too, {User_Name}!"]),
                                     children=[HowCanHelpYouOutput.goto()]
                             )
                         ]
                 )
             ]
     )