Exemple #1
0
 def create():
     return Folder(
         _id="folder_routing_sequences",
         label="ROUTING SEQUENCES",
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             Input(Grammar(watson_items=[
                 "out-of-scope movie topics", "$ (OTHER_MOVIE)={Topic}"
             ]),
                   children=[
                       TopicAction.set_to_value(),
                       Goto(ref="output_no_topic_lookup")
                   ]),
             Input(Grammar(watson_items=[
                 "by out-of-scope movie topics",
                 "$ (BY_OTHER_MOVIE)={Topic}"
             ]),
                   children=[
                       TopicAction.set_to_value(),
                       Goto(ref="output_2503370")
                   ]),
             Input(Grammar(watson_items=[
                 "unsupported genres", "$ (UNSUPPORTED_GENRES)={Topic}"
             ]),
                   children=[
                       TopicAction.set_to_value(),
                       Goto(ref="output_2510164")
                   ]),
             Input(Grammar(watson_items=[
                 "old movies", "$ old movies", "$ classic movies",
                 "$ oldies", "$ classics"
             ]),
                   children=[Goto(ref="output_2503380")]),
             Input(Grammar(watson_items=[
                 "Review", "$ review", "$ find movies by rating",
                 "$ look up movies by rating", "$ highest rating",
                 "$ highest rated", "$ best rating", "$ best rated",
                 "$ lowest rating", "$ lowest rated", "$ oscar winners",
                 "$ best movie", "$ best movies"
             ]),
                   children=[
                       GreetingAction.reset(),
                       SmallTalkAction.set_to_zero(),
                       Goto(ref="output_2469539")
                   ]),
             Input(Grammar(["Movie theaters", "$ movie theaters"]),
                   children=[Goto(ref="output_2503320")]),
             Input(Grammar(
                 watson_items=["trailer", "$ trailer", "$ trailers"]),
                   children=[
                       GreetingAction.reset(),
                       SmallTalkAction.set_to_zero(),
                       Goto(ref="output_2510290")
                   ])
         ])
Exemple #2
0
 def create():
     return Input(
         Grammar(
             watson_items=[
                 "Favorites",
                 "$ favorites",
                 "$ favorite movies",
                 "$ favorited",
                 "$ hearted"
             ]
         ),
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             Output(
                 Prompt(
                     items=[
                         "When you get the details for a movie, you can save the movie in your <i>Favorites</i> by clicking on the heart icon above the trailer."]
                 ),
                 children=[
                     GetUserInput(
                         children=[
                             Input(
                                 GenericGrammar.ok(),
                                 children=[HowCanHelpYouOutput.goto()]
                             ),
                             PreliminarySequencesSearch.goto()
                         ]
                     )
                 ]
             )
         ]
     )
Exemple #3
0
 def create():
     return Input(
         Grammar(
             watson_items=[
                 "Details",
                 "$ details",
                 "$ detail",
                 "$ movie info",
                 "$ movie information"
             ]
         ),
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             Output(
                 Prompt(
                     items=[
                         "After searching for movies, you can click on a particular movie result to see <i>details</i>, such as rating, summary and trailer.", ]
                 ),
                 children=[
                     GetUserInput(
                         children=[
                             Input(
                                 GenericGrammar.ok(),
                                 children=[HowCanHelpYouOutput.goto()]
                             ),
                             PreliminarySequencesSearch.goto()
                         ]
                     )
                 ]
             )
         ]
     )
Exemple #4
0
 def create():
     return Folder(
         label="BASE SEQUENCES",
         _id="folder_base_sequences",
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             FavoritesInput.create(),
             DetailsInput.create(),
             # ShowtimesInput.create(),
             MainSearchCriteriaInput.create(),
         ],
     )
Exemple #5
0
 def create():
     return Folder(
         label="BASE SEQUENCES",
         _id="folder_base_sequences",
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             FavoritesInput.create(),
             DetailsInput.create(),
             # ShowtimesInput.create(),
             MainSearchCriteriaInput.create()
         ]
     )
Exemple #6
0
 def create():
     return Input(
         Grammar(watson_items=[
             "Details", "$ details", "$ detail", "$ movie info",
             "$ movie information"
         ]),
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             Output(Prompt(items=[
                 "After searching for movies, you can click on a particular movie result to see <i>details</i>, such as rating, summary and trailer.",
             ]),
                    children=[
                        GetUserInput(children=[
                            Input(GenericGrammar.ok(),
                                  children=[HowCanHelpYouOutput.goto()]),
                            PreliminarySequencesSearch.goto()
                        ])
                    ])
         ])
Exemple #7
0
 def create():
     return Folder(
         _id="folder_routing_sequences",
         label="ROUTING SEQUENCES",
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             Input(
                 Grammar(
                     watson_items=[
                         "out-of-scope movie topics",
                         "$ (OTHER_MOVIE)={Topic}"
                     ]
                 ),
                 children=[
                     TopicAction.set_to_value(),
                     Goto(ref="output_no_topic_lookup")
                 ]
             ),
             Input(
                 Grammar(
                     watson_items=[
                         "by out-of-scope movie topics",
                         "$ (BY_OTHER_MOVIE)={Topic}"
                     ]
                 ),
                 children=[
                     TopicAction.set_to_value(),
                     Goto(ref="output_2503370")
                 ]
             ),
             Input(
                 Grammar(
                     watson_items=[
                         "unsupported genres",
                         "$ (UNSUPPORTED_GENRES)={Topic}"
                     ]
                 ),
                 children=[
                     TopicAction.set_to_value(),
                     Goto(ref="output_2510164")
                 ]
             ),
             Input(
                 Grammar(
                     watson_items=[
                         "old movies",
                         "$ old movies",
                         "$ classic movies",
                         "$ oldies",
                         "$ classics"
                     ]
                 ),
                 children=[Goto(ref="output_2503380")]
             ),
             Input(
                 Grammar(
                     watson_items=[
                         "Review",
                         "$ review",
                         "$ find movies by rating",
                         "$ look up movies by rating",
                         "$ highest rating",
                         "$ highest rated",
                         "$ best rating",
                         "$ best rated",
                         "$ lowest rating",
                         "$ lowest rated",
                         "$ oscar winners",
                         "$ best movie",
                         "$ best movies"
                     ]
                 ),
                 children=[
                     GreetingAction.reset(),
                     SmallTalkAction.set_to_zero(),
                     Goto(ref="output_2469539")
                 ]
             ),
             Input(
                 Grammar(
                     [
                         "Movie theaters",
                         "$ movie theaters"
                     ]
                 ),
                 children=[
                     Goto(ref="output_2503320")
                 ]
             ),
             Input(
                 Grammar(
                     watson_items=[
                         "trailer",
                         "$ trailer",
                         "$ trailers"
                     ]
                 ),
                 children=[
                     GreetingAction.reset(),
                     SmallTalkAction.set_to_zero(),
                     Goto(ref="output_2510290")
                 ]
             )
         ]
     )
Exemple #8
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()
                     ])
                 ])
         ])
Exemple #9
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()]
                             )
                         ]
                 )
             ]
     )
Exemple #10
0
    def create():
        return Folder(
            label="PRELIMINARY SEQUENCES",
            _id=PreliminarySequencesFolder._id(),
            children=[
                GreetingAction.reset(),
                SmallTalkAction.set_to_zero(),
                Input(
                    Grammar(
                        watson_items=[
                            "Do you know",
                            "$ do you know",
                            "$ can you",
                            "$ do you have information",
                            "$ can I",
                            "$ can you tell",
                            "$ what kind of",
                            "$ what else do you know"
                        ]
                    ),
                    children=[
                        GreetingAction.reset(),
                        SmallTalkAction.set_to_zero(),
                        Input(
                            Grammar(
                                watson_items=[
                                    "out-of-scope movie topics",
                                    "$ (OTHER_MOVIE)={Topic}"
                                ]
                            ),
                            children=[
                                TopicAction.set_to_value(),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "what",
                                            "$ what"
                                        ]
                                    ),
                                    children=[Goto(ref="output_no_topic_lookup")]
                                ),
                                Output(
                                    Prompt(items=["No."]),
                                    children=[
                                        Output(
                                            _id="output_no_topic_lookup",
                                            prompt=Prompt(
                                                items=[
                                                    "I'm afraid I can't look up movies by {Topic}, only by Genre or MPAA Rating."]
                                            ),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            GenericGrammar.ok(),
                                                            children=[
                                                                HowCanHelpYouOutput.goto()
                                                            ]
                                                        ),
                                                        PreliminarySequencesSearch.goto()
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                )
                            ]
                        ),
                        Input(
                            Grammar(
                                watson_items=[
                                    "by out-of-scope movie topics",
                                    "$ (BY_OTHER_MOVIE)={Topic}"
                                ]
                            ),
                            children=[
                                TopicAction.set_to_value(),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "what",
                                            "$ what"
                                        ]
                                    ),
                                    children=[Goto(ref="output_2503370")]
                                ),
                                Output(
                                    Prompt(
                                        items=["No."]
                                    ),
                                    children=[
                                        Output(
                                            _id="output_2503370",
                                            prompt=Prompt(
                                                items=[
                                                    "I'm afraid I can't look up {Topic}, only Current and Upcoming movies by Genre or MPAA Rating.", ]
                                            ),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            Grammar(watson_items=["Okay."]),
                                                            children=[HowCanHelpYouOutput.goto()]
                                                        ),
                                                        PreliminarySequencesSearch.goto()
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                )
                            ]
                        ),
                        Input(
                            Grammar(
                                watson_items=[
                                    "unsupported genres",
                                    "$ (UNSUPPORTED_GENRES)={Topic}"
                                ]
                            ),
                            children=[
                                TopicAction.set_to_value(),
                                Input(
                                    grammar=Grammar(
                                        watson_items=[
                                            "what",
                                            "$ what"
                                        ]
                                    ),
                                    children=[Goto(ref="output_2510164")]
                                ),
                                Output(
                                    Prompt(items=["No."]),
                                    children=[
                                        Output(
                                            _id="output_2510164",
                                            prompt=Prompt(
                                                items=[
                                                    "I'm afraid {Topic} isn't a movie genre I know. Please try another one."]
                                            ),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            grammar=Grammar(
                                                                watson_items=["Okay."]
                                                            ),
                                                            children=[HowCanHelpYouOutput.goto()]
                                                        ),
                                                        PreliminarySequencesSearch.goto()
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                )
                            ]
                        ),
                        # {
                        #     (0, "grammar"): {
                        #         "item": [
                        #             "theaters",
                        #             "$ theaters",
                        #             "$ fandango"
                        #         ]
                        #     },
                        #     (1, "input"): {
                        #         (0, "grammar"): {
                        #             "item": [
                        #                 "what",
                        #                 "$ what"
                        #             ]
                        #         },
                        #         (1, "goto"): {
                        #             "@ref": "output_2503320"
                        #         }
                        #     },
                        #     (2, "output"): {
                        #         (0, "prompt"): {
                        #             "item": "No."
                        #         },
                        #         (1, "output"): {
                        #             "@id": "output_2503320",
                        #             (0, "prompt"): {
                        #                 "item": "I'm afraid I cannot look up theaters myself, but I can give you a link to Fandango.com where you can buy tickets in your ZIP code. ",
                        #                 "@selectionType": "RANDOM"
                        #             },
                        #             (1, "getUserInput"): {
                        #                 (0, "input"): {
                        #                     (0, "grammar"): GenericGrammar.ok(),
                        #                     (1, "goto"): HowCanHelpYouOutput.goto()
                        #                 },
                        #                 (1, "goto"): PreliminarySequencesSearch.goto()
                        #             }
                        #         }
                        #     }
                        # },
                        Input(
                            Grammar(
                                watson_items=["$ (STYLE)={Style_Preference}"]
                            ),
                            children=[
                                StylePreferenceAction.set_to_value(),
                                Goto(ref="search_2414740")
                            ]
                        ),
                        Input(
                            Grammar(
                                watson_items=[
                                    "genres",
                                    "$ genres"
                                ]
                            ),
                            children=[
                                Output(
                                    Prompt(
                                        items=[
                                            "Action, adventure, animated, comedy, crime, documentary, drama, family, fantasy, foreign, historical, horror, music, mystery, romance, science fiction, TV movie, thriller, war movies and western.  <br> <br>"]
                                    ),
                                    children=[
                                        GetUserInput(
                                            children=[
                                                Input(
                                                    GenericGrammar.ok(),
                                                    children=[HowCanHelpYouOutput.goto()]
                                                ),
                                                PreliminarySequencesSearch.goto()
                                            ]
                                        )
                                    ]
                                )
                            ]
                        ),
                        # {
                        #     (0, "grammar"): {
                        #         "item": [
                        #             "old movies",
                        #             "$ old movies",
                        #             "$ classic movies",
                        #             "$ oldies",
                        #             "$ classics"
                        #         ]
                        #     },
                        #     (1, "input"): {
                        #         (0, "grammar"): {
                        #             "item": [
                        #                 "what",
                        #                 "$ what"
                        #             ]
                        #         },
                        #         (1, "goto"): {
                        #             "@ref": "output_2503380"
                        #         }
                        #     },
                        #     (2, "output"): {
                        #         (0, "prompt"): {
                        #             "item": "No."
                        #         },
                        #         (1, "output"): {
                        #             "@id": "output_2503380",
                        #             (0, "prompt"): {
                        #                 "item": "I'm afraid I cannot look up Old Movies, only Current and Upcoming.",
                        #                 "@selectionType": "RANDOM"
                        #             },
                        #             (1, "getUserInput"): {
                        #                 (0, "input"): {
                        #                     (0, "grammar"): GenericGrammar.ok(),
                        #                     (1, "goto"): HowCanHelpYouOutput.goto()
                        #                 },
                        #                 (1, "goto"): PreliminarySequencesSearch.goto()
                        #             }
                        #         }
                        #     }
                        # },
                        Input(
                            Grammar(
                                watson_items=[
                                    "shoes",
                                    "$ shoes"
                                ]
                            ),
                            children=[
                                TopicAction.set_to_shoes(),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "what",
                                            "$ what"
                                        ]
                                    ),
                                    children=[
                                        Goto(ref="output_what_jemboo_knows")
                                    ]
                                ),
                                Output(
                                    prompt=Prompt(
                                        items=["Yes."]
                                    ),
                                    children=[
                                        Output(
                                            _id="output_what_jemboo_knows",
                                            prompt=Prompt(
                                                items=[
                                                    "I can look up current and upcoming movies by Genre or MPAA Rating and show you trailers for them. But I'm afraid I cannot search by number of stars or by movie titles or actor and director names at this time.", ]
                                            ),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            GenericGrammar.ok(),
                                                            children=[HowCanHelpYouOutput.goto()]
                                                        ),
                                                        PreliminarySequencesSearch.goto()
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                )
                            ]
                        ),
                        # {
                        #     (0, "grammar"): {
                        #         "item": [
                        #             "trailer",
                        #             "$ trailer",
                        #             "$ trailers"
                        #         ]
                        #     },
                        #     (1, "input"): {
                        #         (0, "grammar"): {
                        #             "item": [
                        #                 "what",
                        #                 "$ what"
                        #             ]
                        #         },
                        #         (1, "goto"): {
                        #             "@ref": "output_2510290"
                        #         }
                        #     },
                        #     (2, "output"): {
                        #         (0, "prompt"): {
                        #             "item": "Yes."
                        #         },
                        #         (1, "output"): {
                        #             "@id": "output_2510290",
                        #             (0, "prompt"): {
                        #                 "item": "After searching for movies, you can click on a particular movie result to watch its <i>trailer</i>, or video preview.",
                        #                 "@selectionType": "RANDOM"
                        #             },
                        #             (1, "getUserInput"): {
                        #                 (0, "input"): {
                        #                     (0, "grammar"): GenericGrammar.ok(),
                        #                     (1, "goto"): HowCanHelpYouOutput.goto()
                        #                 },
                        #                 (1, "goto"): PreliminarySequencesSearch.goto()
                        #             }
                        #         }
                        #     }
                        # },
                        Input(
                            Grammar(
                                watson_items=[
                                    "out-of-scope topics",
                                    "$ (DINING)={Topic}",
                                    "$ (WEATHER)={Topic}",
                                    "$ (TRAFFIC)={Topic}"
                                ]
                            ),
                            children=[
                                TopicAction.set_to_value(),
                                OutOfScopeCountAction.increment(),
                                If(
                                    elements=[
                                        OutOfScopeCountConditions.is_greater_then("2"),
                                        Output(
                                            Prompt(
                                                items=[
                                                    "I'm sorry I don't know about that. Can I look up some shoes for you?"]
                                            ),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            GenericGrammar.yes(),
                                                            children=[
                                                                StylePreferenceProfileCheck.goto()
                                                            ]
                                                        ),
                                                        Input(
                                                            GenericGrammar.no(),
                                                            children=[
                                                                Action(var_name="Out-of-Scope_Count", operator="SET_TO",
                                                                       text="0"),
                                                                Output(
                                                                    prompt=GenericPrompt.ok_fine()
                                                                )
                                                            ]
                                                        ),
                                                        Input(
                                                            GenericGrammar.ok(),
                                                            children=[
                                                                StylePreferenceProfileCheck.goto()
                                                            ]
                                                        ),
                                                        PreliminarySequencesSearch.goto()
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                ),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "what",
                                            "$ what"
                                        ]
                                    ),
                                    children=[Goto(ref="output_2497989")]
                                ),
                                Output(
                                    Prompt(items=["No."]),
                                    children=[

                                        Output(
                                            _id="output_2497989",
                                            prompt=Prompt(
                                                items=["I'm afraid I don't know much about {Topic}. Just movies."]),
                                            children=[
                                                GetUserInput(
                                                    children=[
                                                        Input(
                                                            Grammar(watson_items=["Okay."]),
                                                            children=[HowCanHelpYouOutput.goto()]
                                                        ),
                                                        PreliminarySequencesSearch.goto()
                                                    ]
                                                )
                                            ]
                                        )
                                    ]
                                )
                            ]
                        ),
                        Goto(ref="output_what_jemboo_knows")
                    ]
                )
            ]
        )
Exemple #11
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()]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
Exemple #12
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()
                            ]
                        )
                    ]
                )
            ]
        )
Exemple #13
0
 def create():
     return Folder(
         label="PRELIMINARY SEQUENCES",
         _id=PreliminarySequencesFolder._id(),
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             Input(
                 Grammar(watson_items=[
                     "Do you know", "$ do you know", "$ can you",
                     "$ do you have information", "$ can I",
                     "$ can you tell", "$ what kind of",
                     "$ what else do you know"
                 ]),
                 children=[
                     GreetingAction.reset(),
                     SmallTalkAction.set_to_zero(),
                     Input(
                         Grammar(watson_items=[
                             "out-of-scope movie topics",
                             "$ (OTHER_MOVIE)={Topic}"
                         ]),
                         children=[
                             TopicAction.set_to_value(),
                             Input(Grammar(watson_items=["what", "$ what"]),
                                   children=[
                                       Goto(ref="output_no_topic_lookup")
                                   ]),
                             Output(
                                 Prompt(items=["No."]),
                                 children=[
                                     Output(
                                         _id="output_no_topic_lookup",
                                         prompt=Prompt(items=[
                                             "I'm afraid I can't look up movies by {Topic}, only by Genre or MPAA Rating."
                                         ]),
                                         children=[
                                             GetUserInput(children=[
                                                 Input(
                                                     GenericGrammar.ok(),
                                                     children=[
                                                         HowCanHelpYouOutput
                                                         .goto()
                                                     ]),
                                                 PreliminarySequencesSearch.
                                                 goto()
                                             ])
                                         ])
                                 ])
                         ]),
                     Input(
                         Grammar(watson_items=[
                             "by out-of-scope movie topics",
                             "$ (BY_OTHER_MOVIE)={Topic}"
                         ]),
                         children=[
                             TopicAction.set_to_value(),
                             Input(
                                 Grammar(watson_items=["what", "$ what"]),
                                 children=[Goto(ref="output_2503370")]),
                             Output(
                                 Prompt(items=["No."]),
                                 children=[
                                     Output(
                                         _id="output_2503370",
                                         prompt=Prompt(items=[
                                             "I'm afraid I can't look up {Topic}, only Current and Upcoming movies by Genre or MPAA Rating.",
                                         ]),
                                         children=[
                                             GetUserInput(children=[
                                                 Input(Grammar(
                                                     watson_items=["Okay."
                                                                   ]),
                                                       children=[
                                                           HowCanHelpYouOutput
                                                           .goto()
                                                       ]),
                                                 PreliminarySequencesSearch.
                                                 goto()
                                             ])
                                         ])
                                 ])
                         ]),
                     Input(
                         Grammar(watson_items=[
                             "unsupported genres",
                             "$ (UNSUPPORTED_GENRES)={Topic}"
                         ]),
                         children=[
                             TopicAction.set_to_value(),
                             Input(
                                 grammar=Grammar(
                                     watson_items=["what", "$ what"]),
                                 children=[Goto(ref="output_2510164")]),
                             Output(
                                 Prompt(items=["No."]),
                                 children=[
                                     Output(
                                         _id="output_2510164",
                                         prompt=Prompt(items=[
                                             "I'm afraid {Topic} isn't a movie genre I know. Please try another one."
                                         ]),
                                         children=[
                                             GetUserInput(children=[
                                                 Input(grammar=Grammar(
                                                     watson_items=["Okay."
                                                                   ]),
                                                       children=[
                                                           HowCanHelpYouOutput
                                                           .goto()
                                                       ]),
                                                 PreliminarySequencesSearch.
                                                 goto()
                                             ])
                                         ])
                                 ])
                         ]),
                     # {
                     #     (0, "grammar"): {
                     #         "item": [
                     #             "theaters",
                     #             "$ theaters",
                     #             "$ fandango"
                     #         ]
                     #     },
                     #     (1, "input"): {
                     #         (0, "grammar"): {
                     #             "item": [
                     #                 "what",
                     #                 "$ what"
                     #             ]
                     #         },
                     #         (1, "goto"): {
                     #             "@ref": "output_2503320"
                     #         }
                     #     },
                     #     (2, "output"): {
                     #         (0, "prompt"): {
                     #             "item": "No."
                     #         },
                     #         (1, "output"): {
                     #             "@id": "output_2503320",
                     #             (0, "prompt"): {
                     #                 "item": "I'm afraid I cannot look up theaters myself, but I can give you a link to Fandango.com where you can buy tickets in your ZIP code. ",
                     #                 "@selectionType": "RANDOM"
                     #             },
                     #             (1, "getUserInput"): {
                     #                 (0, "input"): {
                     #                     (0, "grammar"): GenericGrammar.ok(),
                     #                     (1, "goto"): HowCanHelpYouOutput.goto()
                     #                 },
                     #                 (1, "goto"): PreliminarySequencesSearch.goto()
                     #             }
                     #         }
                     #     }
                     # },
                     Input(Grammar(
                         watson_items=["$ (STYLE)={Style_Preference}"]),
                           children=[
                               StylePreferenceAction.set_to_value(),
                               Goto(ref="search_2414740")
                           ]),
                     Input(
                         Grammar(watson_items=["genres", "$ genres"]),
                         children=[
                             Output(Prompt(items=[
                                 "Action, adventure, animated, comedy, crime, documentary, drama, family, fantasy, foreign, historical, horror, music, mystery, romance, science fiction, TV movie, thriller, war movies and western.  <br> <br>"
                             ]),
                                    children=[
                                        GetUserInput(children=[
                                            Input(GenericGrammar.ok(),
                                                  children=[
                                                      HowCanHelpYouOutput.
                                                      goto()
                                                  ]),
                                            PreliminarySequencesSearch.goto(
                                            )
                                        ])
                                    ])
                         ]),
                     # {
                     #     (0, "grammar"): {
                     #         "item": [
                     #             "old movies",
                     #             "$ old movies",
                     #             "$ classic movies",
                     #             "$ oldies",
                     #             "$ classics"
                     #         ]
                     #     },
                     #     (1, "input"): {
                     #         (0, "grammar"): {
                     #             "item": [
                     #                 "what",
                     #                 "$ what"
                     #             ]
                     #         },
                     #         (1, "goto"): {
                     #             "@ref": "output_2503380"
                     #         }
                     #     },
                     #     (2, "output"): {
                     #         (0, "prompt"): {
                     #             "item": "No."
                     #         },
                     #         (1, "output"): {
                     #             "@id": "output_2503380",
                     #             (0, "prompt"): {
                     #                 "item": "I'm afraid I cannot look up Old Movies, only Current and Upcoming.",
                     #                 "@selectionType": "RANDOM"
                     #             },
                     #             (1, "getUserInput"): {
                     #                 (0, "input"): {
                     #                     (0, "grammar"): GenericGrammar.ok(),
                     #                     (1, "goto"): HowCanHelpYouOutput.goto()
                     #                 },
                     #                 (1, "goto"): PreliminarySequencesSearch.goto()
                     #             }
                     #         }
                     #     }
                     # },
                     Input(
                         Grammar(watson_items=["shoes", "$ shoes"]),
                         children=[
                             TopicAction.set_to_shoes(),
                             Input(
                                 Grammar(watson_items=["what", "$ what"]),
                                 children=[
                                     Goto(ref="output_what_jemboo_knows")
                                 ]),
                             Output(
                                 prompt=Prompt(items=["Yes."]),
                                 children=[
                                     Output(
                                         _id="output_what_jemboo_knows",
                                         prompt=Prompt(items=[
                                             "I can look up current and upcoming movies by Genre or MPAA Rating and show you trailers for them. But I'm afraid I cannot search by number of stars or by movie titles or actor and director names at this time.",
                                         ]),
                                         children=[
                                             GetUserInput(children=[
                                                 Input(
                                                     GenericGrammar.ok(),
                                                     children=[
                                                         HowCanHelpYouOutput
                                                         .goto()
                                                     ]),
                                                 PreliminarySequencesSearch.
                                                 goto()
                                             ])
                                         ])
                                 ])
                         ]),
                     # {
                     #     (0, "grammar"): {
                     #         "item": [
                     #             "trailer",
                     #             "$ trailer",
                     #             "$ trailers"
                     #         ]
                     #     },
                     #     (1, "input"): {
                     #         (0, "grammar"): {
                     #             "item": [
                     #                 "what",
                     #                 "$ what"
                     #             ]
                     #         },
                     #         (1, "goto"): {
                     #             "@ref": "output_2510290"
                     #         }
                     #     },
                     #     (2, "output"): {
                     #         (0, "prompt"): {
                     #             "item": "Yes."
                     #         },
                     #         (1, "output"): {
                     #             "@id": "output_2510290",
                     #             (0, "prompt"): {
                     #                 "item": "After searching for movies, you can click on a particular movie result to watch its <i>trailer</i>, or video preview.",
                     #                 "@selectionType": "RANDOM"
                     #             },
                     #             (1, "getUserInput"): {
                     #                 (0, "input"): {
                     #                     (0, "grammar"): GenericGrammar.ok(),
                     #                     (1, "goto"): HowCanHelpYouOutput.goto()
                     #                 },
                     #                 (1, "goto"): PreliminarySequencesSearch.goto()
                     #             }
                     #         }
                     #     }
                     # },
                     Input(
                         Grammar(watson_items=[
                             "out-of-scope topics", "$ (DINING)={Topic}",
                             "$ (WEATHER)={Topic}", "$ (TRAFFIC)={Topic}"
                         ]),
                         children=[
                             TopicAction.set_to_value(),
                             OutOfScopeCountAction.increment(),
                             If(elements=[
                                 OutOfScopeCountConditions.is_greater_then(
                                     "2"),
                                 Output(Prompt(items=[
                                     "I'm sorry I don't know about that. Can I look up some shoes for you?"
                                 ]),
                                        children=[
                                            GetUserInput(children=[
                                                Input(
                                                    GenericGrammar.yes(),
                                                    children=[
                                                        StylePreferenceProfileCheck
                                                        .goto()
                                                    ]),
                                                Input(
                                                    GenericGrammar.no(),
                                                    children=[
                                                        Action(
                                                            var_name=
                                                            "Out-of-Scope_Count",
                                                            operator=
                                                            "SET_TO",
                                                            text="0"),
                                                        Output(prompt=
                                                               GenericPrompt
                                                               .ok_fine())
                                                    ]),
                                                Input(
                                                    GenericGrammar.ok(),
                                                    children=[
                                                        StylePreferenceProfileCheck
                                                        .goto()
                                                    ]),
                                                PreliminarySequencesSearch.
                                                goto()
                                            ])
                                        ])
                             ]),
                             Input(Grammar(watson_items=["what", "$ what"]),
                                   children=[Goto(ref="output_2497989")]),
                             Output(
                                 Prompt(items=["No."]),
                                 children=[
                                     Output(
                                         _id="output_2497989",
                                         prompt=Prompt(items=[
                                             "I'm afraid I don't know much about {Topic}. Just movies."
                                         ]),
                                         children=[
                                             GetUserInput(children=[
                                                 Input(Grammar(
                                                     watson_items=["Okay."
                                                                   ]),
                                                       children=[
                                                           HowCanHelpYouOutput
                                                           .goto()
                                                       ]),
                                                 PreliminarySequencesSearch.
                                                 goto()
                                             ])
                                         ])
                                 ])
                         ]),
                     Goto(ref="output_what_jemboo_knows")
                 ])
         ])
Exemple #14
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()])
                 ])
         ])
Exemple #15
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()
                                            ])
                                 ])
                         ])
                 ])
         ])