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

                                        PreliminarySequencesSearch.goto()
                                    ]
                                ),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "Why do you need to know?",
                                            "$ why",
                                            "$ need to know",
                                            "$ use it",
                                            "$ do with it"
                                        ]
                                    ),
                                    children=[
                                        Output(
                                            prompt=Prompt(
                                                items=["Just trying to be friendly."]
                                            ),
                                            children=[StartSearch.goto()]
                                        )
                                    ]
                                ),
                                Input(
                                    Grammar(
                                        watson_items=[
                                            "I don't want to give it!",
                                            "$ don't want",
                                            "$ no",
                                            "$ refuse",
                                            "$ none of your business"
                                        ]
                                    ),
                                    children=[
                                        Output(
                                            Prompt(items=["That's fine."]),
                                            children=[StartSearch.goto()]
                                        )
                                    ]
                                ),
                                Input(
                                    ProfileGrammar.create_my_name_is_dynamic_data(),
                                    children=[
                                        UserNameAction.set_to_source(),
                                        Output(
                                            prompt=Prompt(items=["Hi {User_Name}!"]),
                                            children=[StartSearch.goto()]
                                        )
                                    ],
                                    _id="input_user_knownas_name"
                                )
                            ],
                            _id="getUserInput_what_is_your_name"
                        ),
                        StartSearch.create(),
                        HowCanHelpYouOutput.create()
                    ],
                    _id="output_what_is_name"
                )
            ]
        )
Esempio n. 2
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")
                    ]
                )
            ]
        )
Esempio n. 3
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")
                 ])
         ])
Esempio n. 4
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()]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
Esempio n. 5
0
 def create():
     return Input(
         _id="input_main_search_criteria",
         grammar=Grammar(watson_items=[
             "Movies",
             "$ (COLOR)={Color_Preference}",
             "$ (STYLE)={Style_Preference}",
             # "$ movies"
         ]),
         children=[
             GreetingAction.reset(),
             SmallTalkAction.set_to_zero(),
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             TopicAction.set_to_shoes(),
             ColorPreferenceAction.set_to_value(),
             StylePreferenceAction.set_to_value(),
             # DateTimeInput.create(),
             # CertificationPreferenceInput.create(),
             # FamilyFriendlyInput.create(),
             ColorPreferenceInput.create(StylePreferenceInput.goto()),
             StylePreferenceInput.create(Goto(ref="out_of_scope_topics")),
             # ZipcodeInput.create(),
             Input(
                 _id="out_of_scope_topics",
                 grammar=Grammar(watson_items=[
                     "out-of-scope movie topics", "$ (OTHER_MOVIE)={Topic}"
                 ]),
                 children=[
                     TopicAction.set_to_value(),
                     Goto(ref="output_no_topic_lookup")
                 ]),
             StylePreferenceProfileCheck.create(),
             # GenrePreferenceProfileCheck.create(),
             ColorPreferenceProfileCheck.create(),
             Output(
                 _id="output_ok_do_search",
                 prompt=GenericPrompt.ok(),
                 children=[
                     Output(
                         _id="output_search_now",
                         prompt=Prompt(items=["Search_Now"]),
                         children=[
                             Action(
                                 var_name="Last_Results",
                                 operator="SET_TO_NO"),
                             Action(
                                 var_name="First_Results",
                                 operator="SET_TO_NO"),
                             Action(
                                 var_name="Search_Now",
                                 operator="SET_TO_YES"),
                             Action(
                                 var_name="First_Time",
                                 operator="SET_TO_NO"),
                             Input(
                                 Grammar(
                                     watson_items=["UPDATE NUM_MOVIES"]),
                                 children=[
                                     If(elements=[
                                         ResultsCountConditions.equals_zero(
                                         ),
                                         Output(Prompt(items=[
                                             "I'm afraid I found {%s} matching {Color_Preference} {Style_Preference}. Try changing your criteria."
                                             % NAME_RESULTS_COUNT
                                         ]),
                                                children=[
                                                    GetUserInput(children=[
                                                        Input(
                                                            GenericGrammar.
                                                            ok(),
                                                            children=[
                                                                ColorPreferenceAction
                                                                .
                                                                set_to_blank(
                                                                ),
                                                                StylePreferenceAction
                                                                .
                                                                set_to_blank(
                                                                ),
                                                                StylePreferenceProfileCheck
                                                                .goto(),
                                                                RemoveColorInput
                                                                .goto()
                                                            ]),
                                                        RemoveColorInput.
                                                        goto()
                                                    ])
                                                ])
                                     ]),
                                     If(elements=[
                                         StyleConditions.is_blank(),
                                         ColorConditions.has_value(),
                                         Output(Prompt(items=[
                                             "Good choice, {User_Name}! I found {%s} results for {Recency_Preference} {Color_Preference}-rated movies."
                                             % NAME_RESULTS_COUNT
                                         ]),
                                                children=[
                                                    AfterSearchResults.goto(
                                                    )
                                                ])
                                     ]),
                                     If(elements=[
                                         ColorConditions.is_blank(),
                                         StyleConditions.has_value(),
                                         Output(Prompt(items=[
                                             "Good choice, {User_Name}! I found {%s} results for {Color_Preference} {Style_Preference} movies."
                                             % NAME_RESULTS_COUNT
                                         ]),
                                                children=[
                                                    AfterSearchResults.goto(
                                                    )
                                                ])
                                     ]),
                                     If(elements=[
                                         ColorConditions.is_blank(),
                                         StyleConditions.is_blank(),
                                         Output(Prompt(items=[
                                             "I found {%s} results for ALL {Recency_Preference} movies."
                                             % NAME_RESULTS_COUNT
                                         ]),
                                                children=[
                                                    AfterSearchResults.goto(
                                                    )
                                                ])
                                     ]),
                                     Output(Prompt(items=[
                                         "Good choices, {User_Name}! I found {%s} results for {Color_Preference} {Style_Preference} movies."
                                         % NAME_RESULTS_COUNT
                                     ]),
                                            children=[
                                                AfterSearchResults.create()
                                            ])
                                 ])
                         ])
                 ])
         ])