示例#1
0
 def create():
     return Input(
         Grammar(watson_items=["again", "$ again", "$ one more time"]),
         children=[
             PageAction.set_to_repeat(),
             Goto(ref="output_ok_do_search")
         ])
示例#2
0
 def create():
     return Input(
         Grammar(
             watson_items=[
                 "again",
                 "$ again",
                 "$ one more time"
             ]),
         children=[
             PageAction.set_to_repeat(),
             Goto(ref="output_ok_do_search")
         ]
     )
示例#3
0
 def create():
     return Input(
         _id=RemoveColorInput.__id(),
         grammar=Grammar(watson_items=[
             "Remove genre", "$ remove (COLOR)={Color_Preference}",
             "$ cancel (COLOR)={Color_Preference}", "$ remove color",
             "$ cancel color", "$ any color", "$ all color"
         ]),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             ColorPreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ])
示例#4
0
 def create():
     return Input(
         grammar=Grammar(
             watson_items=[
                 "all items",
                 "$ all items",
                 "$ all results"
             ]
         ),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             StylePreferenceAction.set_to_blank(),
             ColorPreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ]
     )
示例#5
0
 def create():
     return Input(
         _id=RemoveColorInput.__id(),
         grammar=Grammar(
             watson_items=[
                 "Remove genre",
                 "$ remove (COLOR)={Color_Preference}",
                 "$ cancel (COLOR)={Color_Preference}",
                 "$ remove color",
                 "$ cancel color",
                 "$ any color",
                 "$ all color"
             ]
         ),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             ColorPreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ]
     )
示例#6
0
 def create():
     return Input(
         Grammar(
             watson_items=[
                 "Remove rating",
                 "$ remove (STYLE)={Style_Preference}",
                 "$ cancel (STYLE)={Style_Preference}",
                 "$ remove style",
                 "$ cancel style",
                 "$ all styles",
                 "$ all style",
                 "$ any styles",
                 "$ any style"
             ]
         ),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             StylePreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ]
     )
示例#7
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()
                     ])
                 ])
         ])
示例#8
0
 def create():
     return GetUserInput(
         _id=StylePreferenceProfileCheckInput.__id(),
         children=[
             Input(
                 Grammar(
                     watson_items=[
                         "What",
                         "$ what",
                         "$ which",
                         "$ tell me"
                     ]
                 ),
                 children=[
                     Input(
                         Grammar(
                             watson_items=[
                                 "styles",
                                 "$ they",
                                 "$ ones",
                                 "$ choices",
                                 "$ options",
                                 "$ styles",
                                 "$ what else"
                             ]
                         ),
                         children=[
                             Output(
                                 Prompt(
                                     items=[
                                         "For example.... Boots, High heels, Sandals, Trainers or Flats <br> <br>"]
                                 ),
                                 children=[StylePreferenceProfileCheckInput.goto()]
                             )
                         ]
                     )
                 ]
             ),
             Input(
                 Grammar(
                     items=[
                         EntityGrammarItem(dynamic_field_assignment="Style_Preference", entity_id="STYLE")
                     ],
                     watson_items=[
                         "Style",
                         "$ (Style)={Style_Preference}"
                     ]
                 ),
                 children=[
                     CurrentIndexAction.set_to_zero(),
                     PageAction.set_to_new(),
                     SearchNowAction.set_to_no(),
                     StylePreferenceAction.set_to_value(),
                     Goto(ref="output_ok_do_search")
                 ]
             ),
             # {
             #     (0, "grammar"): {
             #         "item": [
             #             "NC-17",
             #             "$ NC-17"
             #         ]
             #     },
             #     (1, "output"): {
             #         (0, "prompt"): {
             #             "item": "I'm afraid I cannot look up NC-17-rated movies.",
             #             "@selectionType": "RANDOM"
             #         },
             #         (1, "goto"): StylePreferenceProfileCheckInput.goto()
             #     }
             # },
             Input(
                 Grammar(
                     watson_items=[
                         "No",
                         "$ don't care",
                         "$ don't know",
                         "$ no preference",
                         "$ no",
                         "$ none",
                         "$ all",
                         "$ any",
                         "$ anything",
                         "$ whatever",
                         "$ nothing specific",
                         "$ don't have a preference"
                     ]
                 ),
                 children=[
                     CurrentIndexAction.set_to_zero(),
                     PageAction.set_to_new(),
                     Goto(ref="output_2456875")
                 ]
             ),
             Input(
                 GenericGrammar.yes(),
                 children=[
                     Output(
                         Prompt(items=["What style?", "Please tell me the style you would prefer."]),
                         children=[StylePreferenceProfileCheckInput.goto()]
                     )
                 ]
             ),
             PreliminarySequencesSearch.goto()
         ]
     )
示例#9
0
 def create():
     return GetUserInput(
             _id=ColorPreferenceProfileCheckInput.__id(),
             children=[
                 Input(
                         Grammar(
                                 watson_items=[
                                     "What",
                                     "$ what",
                                     "$ which",
                                     "$ tell me"
                                 ]
                         ),
                         children=[
                             Input(
                                     Grammar(
                                             watson_items=[
                                                 "colors",
                                                 "$ they",
                                                 "$ ones",
                                                 "$ choices",
                                                 "$ options",
                                                 "$ ratings",
                                                 "$ certifications",
                                                 "$ what else"
                                             ]
                                     ),
                                     children=[
                                         Output(
                                                 Prompt(
                                                         items=["Black, White, Red, Brown or Green <br> <br>"]
                                                 ),
                                                 children=[ColorPreferenceProfileCheckInput.goto()]
                                         )
                                     ]
                             )
                         ]
                 ),
                 Input(
                         Grammar(
                                 watson_items=[
                                     "Color",
                                     "$ (COLOR)={Color_Preference}"
                                 ]
                         ),
                         children=[
                             CurrentIndexAction.set_to_zero(),
                             PageAction.set_to_new(),
                             SearchNowAction.set_to_no(),
                             ColorPreferenceAction.set_to_value(),
                             Goto(ref="output_ok_do_search")
                         ]
                 ),
                 # TODO NOT SUPPORTED PATH
                 # {
                 #     (0, "grammar"): {
                 #         "item": [
                 #             "NC-17",
                 #             "$ NC-17"
                 #         ]
                 #     },
                 #     (1, "output"): {
                 #         (0, "prompt"): {
                 #             "item": "I'm afraid I cannot look up NC-17-rated movies.",
                 #             "@selectionType": "RANDOM"
                 #         },
                 #         (1, "goto"): {
                 #             "@ref": "getUserInput_2443780a"
                 #         }
                 #     }
                 # },
                 Input(
                         Grammar(
                                 watson_items=[
                                     "No",
                                     "$ don't care",
                                     "$ don't know",
                                     "$ no preference",
                                     "$ no",
                                     "$ none",
                                     "$ all",
                                     "$ any",
                                     "$ anything",
                                     "$ whatever",
                                     "$ nothing specific",
                                     "$ don't have a preference"
                                 ]
                         ),
                         children=[
                             CurrentIndexAction.set_to_zero(),
                             PageAction.set_to_new(),
                             Goto(ref="output_2456875")
                         ]
                 ),
                 Input(
                         GenericGrammar.yes_okay(wildcard=False),
                         children=[
                             Output(
                                     Prompt(items=["Which one?"]),
                                     children=[ColorPreferenceProfileCheckInput.goto()]
                             )
                         ]
                 ),
                 PreliminarySequencesSearch.goto()
             ]
     )
示例#10
0
 def create():
     return Input(
         grammar=Grammar(
             items=[
                 "more",
                 "$ more",
                 "$ next",
                 "$ forward"
             ]
         ),
         children=[
             Action(var_name="Show_Next", operator="SET_TO_YES"),
             PageAction.set_to_next(),
             Output(
                 Prompt(items=["Okay."]),
                 children=[
                     Output(
                         Prompt(
                             "\"{Search_Now:\"{Search_Now}\", Color:\"{Color_Preference}\", Style:\"{Style_Preference}\", Index:\"{Current_Index}\", Page:\"{Page}\", Total_Movies:\"{%s}\", Total_Pages:\"{Total_Pages}\"}\"" % NAME_RESULTS_COUNT
                         ),
                         children=[
                             Action(var_name="First_Results", operator="SET_TO_NO"),
                             GetUserInput(
                                 _id="getUserInput_2503174",
                                 children=[
                                     Input(
                                         grammar=Grammar(items=["UPDATE CURRENT_INDEX"]),
                                         children=[
                                             Action(var_name="Show_Next", operator="SET_TO_NO"),
                                             Action(var_name="Show_Previous", operator="SET_TO_NO"),
                                             If(
                                                 elements=[
                                                     Condition(name="Last_Results", operator="EQUAL_TO_YES"),
                                                     Output(
                                                         prompt=Prompt(items="Those were the last results"),
                                                         children=[Goto(ref="profileCheck_2503183")]
                                                     )
                                                 ]
                                             ),
                                             If(
                                                 elements=[
                                                     Condition(name="Current_Index", operator="EQUALS",
                                                               root_text="{%s}" % NAME_RESULTS_COUNT),
                                                     Output(
                                                         prompt=Prompt(
                                                             items=["Here are the last results"]
                                                         ),
                                                         children=[
                                                             Action(var_name="Last_Results", operator="SET_TO_YES"),
                                                             Goto(ref="profileCheck_2503183")
                                                         ]
                                                     )
                                                 ]
                                             ),
                                             Output(
                                                 prompt=Prompt(items=["Here is the next set of results"]),
                                                 children=[
                                                     If(
                                                         elements=[
                                                             StyleConditions.is_blank(),
                                                             ColorConditions.has_value(),
                                                             Output(
                                                                 prompt=Prompt(
                                                                     items=[
                                                                         "for {Style_Preference} {Color_Preference}-rated movies."]),
                                                                 children=[AfterSearchResults.goto()]
                                                             )
                                                         ],
                                                         _id="profileCheck_2503183"
                                                     ),
                                                     If(
                                                         elements=[
                                                             ColorConditions.is_blank(),
                                                             StyleConditions.has_value(),
                                                             Output(
                                                                 Prompt(
                                                                     items=[
                                                                         "for {Recency_Preference} {Genre_Preference} movies."]),
                                                                 children=[AfterSearchResults.goto()]
                                                             )
                                                         ]
                                                     ),
                                                     If(
                                                         elements=[
                                                             ColorConditions.is_blank(),
                                                             StyleConditions.is_blank(),
                                                             Output(
                                                                 prompt=Prompt(
                                                                     items=["for ALL {Recency_Preference} movies."]),
                                                                 children=[AfterSearchResults.goto()]
                                                             )
                                                         ]
                                                     ),
                                                     Output(
                                                         Prompt(items=[
                                                             "for {Recency_Preference} {Certification_Preference}-rated {Genre_Preference} movies."]),
                                                         children=[AfterSearchResults.goto()]
                                                     )
                                                 ]
                                             )
                                         ]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
示例#11
0
 def create():
     return Input(
         Grammar(
             watson_items=[
                 "Go back",
                 "$ back",
                 "$ previous",
                 "$ prior"
             ]
         ),
         children=[
             PageAction.set_to_previous(),
             Action("Show_Previous", operator="SET_TO_YES"),
             If(
                 elements=[
                     Condition(name="Current_Index", operator="EQUALS", root_text="10"),
                     Output(
                         prompt=Prompt(items=["Those were the first results"]),
                         children=[Goto(ref="profileCheck_2503183")]
                     )
                 ]
             ),
             Output(
                 prompt=GenericPrompt.ok(),
                 children=[
                     Output(
                         prompt=Prompt(
                             items=[
                                 "\"{Search_Now:\"{Search_Now}\", Style:\"{Style_Preference}\", Rating:\"{Color_Preference}\", Index:\"{Current_Index}\", Page:\"{Page}\"}\""
                             ]
                         ),
                         children=[
                             Action(var_name="Last_Results", operator="SET_TO_NO"),
                             GetUserInput(
                                 children=[
                                     Input(
                                         Grammar(watson_items=["UPDATE CURRENT_INDEX"]),
                                         children=[
                                             Action(var_name="Show_Next", operator="SET_TO_NO"),
                                             Action(var_name="Show_Previous", operator="SET_TO_NO"),
                                             If(
                                                 elements=[
                                                     Condition(name="First_Results", operator="EQUAL_TO_YES"),
                                                     Output(
                                                         prompt=Prompt(items=["Those were the first results"]),
                                                         children=[Goto(ref="getUserInput_2503174")]
                                                     )
                                                 ]
                                             ),
                                             If(
                                                 elements=[
                                                     Condition(name="Current_Index", operator="EQUALS",
                                                               root_text="10"),
                                                     Output(
                                                         prompt=Prompt(items=["Here are the first results"]),
                                                         children=[
                                                             Action(var_name="First_Results", operator="SET_TO_YES"),
                                                             AfterSearchResults.goto()
                                                         ]
                                                     )]
                                             ),
                                             Output(
                                                 prompt=Prompt(items=["Here is the previous set of results"]),
                                                 children=[AfterSearchResults.goto()]
                                             )
                                         ]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
示例#12
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()]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
示例#13
0
    def create():
        from dialog.schema.factories.inputs.main_search_criteria import AgainOption, MoreOption, GoBackOption

        return GetUserInput(
            _id=AfterSearchResults.__id(),
            children=[
                Input(
                    _id="input_2456878",
                    grammar=Grammar(
                        items=[
                            "Okay",
                            "okay",
                            "$ done"
                        ]
                    ),
                    children=[AnythingElseCanHelpWith.create()]
                ),
                Input(
                    Grammar(
                        items=[
                            "What do you mean",
                            "$ what do you mean",
                            "$ what does that mean",
                            "$ what did you mean",
                            "$ what were those movies again",
                            "$ what did you mean",
                            "$ what are those"
                        ]
                    ),
                    children=[
                        Output(
                            prompt=Prompt(
                                items=["These are the {Recency_Preference} movies. Go ahead and click one!"]
                            ),
                            children=[AfterSearchResults.goto()]
                        )
                    ]
                ),
                # TODO could be the details flow?
                # (2, "input"): {
                #     (0, "grammar"): {
                #         "item": [
                #             "When are those showing?",
                #             "$ when * showing",
                #             "$ when * playing",
                #             "$ when * play",
                #             "$ what times * showing",
                #             "$ what times * playing",
                #             "$ what times * play",
                #             "$ what * showtimes",
                #             "$ where * showing",
                #             "$ where * playing",
                #             "$ where * play"
                #         ]
                #     },
                #     (1, "output"): {
                #         "@id": "output_ask_search_for_movies_in_area",
                #         (0, "prompt"): {
                #             "item": "Oh. You mean movies in your area. I must direct you to Fandango for that. Would you like the link?",
                #             "@selectionType": "RANDOM"
                #         },
                #         (1, "getUserInput"): {
                #             (0, "input"): [
                #                 {
                #                     (0, "grammar"): GenericGrammar.yes(),
                #                     (1, "output"): {
                #                         (0, "prompt"): GenericPrompt.ok(),
                #                         (1, "goto"): Goto(ref="output_showtimes_zipcode")
                #                     }
                #                 },
                #                 {
                #                     (0, "grammar"): GenericGrammar.no(),
                #                     (1, "output"): {
                #                         (0, "prompt"): GenericPrompt.ok(),
                #                         (1, "goto"): AfterSearchResults.goto()
                #                     }
                #                 }
                #             ],
                #             (1, "goto"): AfterSearchResults.goto()
                #         }
                #     }
                # },
                # (3, "if"): {
                #     (0, "cond"): {
                #         "@varName": "Popularity_Score",
                #         "@operator": "HAS_VALUE"
                #     },
                #     (1, "input"): [
                #         {
                #             (0, "grammar"): {
                #                 "item": [
                #                     "What are the ratings?",
                #                     "$ ratings for it",
                #                     "$ ratings does it get",
                #                     "$ ratings it gets",
                #                     "$ ratings it got",
                #                     "$ ratings it received",
                #                     "$ its ratings",
                #                     "$ how many * stars",
                #                     "why",
                #                     "why not",
                #                     "why do you say that"
                #                 ]
                #             },
                #             (1, "output"): {
                #                 (0, "prompt"): {
                #                     "item": "{Selected_Movie} gets {Popularity_Score} stars from users.",
                #                     "@selectionType": "RANDOM"
                #                 },
                #                 (1, "getUserInput"): {
                #                     (0, "input"): {
                #                         (0, "grammar"): {
                #                             "item": [
                #                                 "okay",
                #                                 "okay",
                #                                 "$ sucks",
                #                                 "haha"
                #                             ]
                #                         },
                #                         (1, "goto"): AnythingElseCanHelpWith.goto()
                #                     },
                #                     (1, "goto"): {
                #                         "@ref": "input_2456878"
                #                     }
                #                 }
                #             }
                #         },
                #         {
                #             (0, "grammar"): Grammar(
                #                 watson_items=[
                #                     "What is it about?",
                #                     "$ what's is about?"
                #                 ]
                #             ),
                #             (1, "output"): Output(
                #                 Prompt(
                #                     items=["There should be a short description of {Selected_Movie} to the right."]
                #                 ),
                #                 children=[
                #                     GetUserInput(
                #                         children=[
                #                             Input(
                #                                 grammar=Grammar(
                #                                     watson_items=[
                #                                         "okay",
                #                                         "okay",
                #                                         "$ sucks",
                #                                         "haha"
                #                                     ]
                #                                 ),
                #                                 children=[AnythingElseCanHelpWith.goto()]
                #                             ),
                #                             Goto(ref="input_2456878")
                #                         ]
                #                     )
                #                 ]
                #             )
                #         }
                #     ],
                #     (2, "goto"): Goto(ref="input_2459410")
                # },
                Input(
                    _id="input_2459410",
                    grammar=Grammar(
                        watson_items=[
                            "Are those",
                            "$ are those",
                            "$ are these",
                            "$ is that",
                            "$ were those",
                            "$ were these",
                            "$ does this",
                            "$ do these",
                            "$ are they"
                        ]
                    ),
                    children=[
                        Input(
                            Grammar(
                                watson_items=[
                                    "What are",
                                    "$ what are",
                                    "$ what were"
                                ]
                            ),
                            children=[
                                PageAction.set_to_repeat(),
                                Goto(ref="output_search_now")
                            ]
                        ),
                        Input(
                            Grammar(
                                watson_items=[
                                    "all of them",
                                    "$ all",
                                    "$ it"
                                ]
                            ),
                            children=[Goto(ref="profileCheck_2459411")]
                        ),
                        If(
                            _id="profileCheck_2459411",
                            elements=[
                                ResultsCountConditions.less_than("{%s}" % NAME_RESULTS_COUNT),
                                Output(
                                    Prompt(
                                        items=["No. Say <i>show me more</i> if you want to see more."]
                                    ),
                                    children=[AfterSearchResults.goto()]
                                )
                            ]
                        ),
                        Output(
                            Prompt(
                                items=["Yes. I'm afraid that's all of them."]
                            ),
                            children=[AfterSearchResults.goto()]
                        )
                    ]
                ),
                RemoveColorInput.create(),
                RemoveStyleInput.create(),
                RemoveAllSearchCriteriaInput.create(),
                # (8, "input"): Showtimes.create(),
                # (9, "input"): RecencyGenreRatingPreference.create(),
                # (10, "input"): RecencyGenrePreference.create(),
                # (11, "input"): RecencyRatingPreference.create(),
                # (12, "input"): GenreRecencyPreference.create(),
                # (13, "input"): RecencyPreference.create(),
                # (15, "input"): CertificationPreference.create(),
                # (16, "input"): UnsupportedGenre.create(),
                # (17, "input"): DateTimePreference.create(),
                AgainOption.create(),
                MoreOption.create(),
                GoBackOption.create(),
                PreliminarySequencesSearch.goto()
            ]
        )
示例#14
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()
                            ]
                        )
                    ]
                )
            ]
        )
示例#15
0
 def create():
     return Input(
         Grammar(
             watson_items=["Go back", "$ back", "$ previous", "$ prior"]),
         children=[
             PageAction.set_to_previous(),
             Action("Show_Previous", operator="SET_TO_YES"),
             If(elements=[
                 Condition(name="Current_Index",
                           operator="EQUALS",
                           root_text="10"),
                 Output(prompt=Prompt(
                     items=["Those were the first results"]),
                        children=[Goto(ref="profileCheck_2503183")])
             ]),
             Output(
                 prompt=GenericPrompt.ok(),
                 children=[
                     Output(prompt=Prompt(items=[
                         "\"{Search_Now:\"{Search_Now}\", Style:\"{Style_Preference}\", Rating:\"{Color_Preference}\", Index:\"{Current_Index}\", Page:\"{Page}\"}\""
                     ]),
                            children=[
                                Action(var_name="Last_Results",
                                       operator="SET_TO_NO"),
                                GetUserInput(children=[
                                    Input(
                                        Grammar(watson_items=
                                                ["UPDATE CURRENT_INDEX"]),
                                        children=[
                                            Action(var_name="Show_Next",
                                                   operator="SET_TO_NO"),
                                            Action(var_name="Show_Previous",
                                                   operator="SET_TO_NO"),
                                            If(elements=[
                                                Condition(
                                                    name="First_Results",
                                                    operator="EQUAL_TO_YES"
                                                ),
                                                Output(prompt=Prompt(items=[
                                                    "Those were the first results"
                                                ]),
                                                       children=[
                                                           Goto(
                                                               ref=
                                                               "getUserInput_2503174"
                                                           )
                                                       ])
                                            ]),
                                            If(elements=[
                                                Condition(
                                                    name="Current_Index",
                                                    operator="EQUALS",
                                                    root_text="10"),
                                                Output(prompt=Prompt(items=[
                                                    "Here are the first results"
                                                ]),
                                                       children=[
                                                           Action(
                                                               var_name=
                                                               "First_Results",
                                                               operator=
                                                               "SET_TO_YES"
                                                           ),
                                                           AfterSearchResults
                                                           .goto()
                                                       ])
                                            ]),
                                            Output(prompt=Prompt(items=[
                                                "Here is the previous set of results"
                                            ]),
                                                   children=[
                                                       AfterSearchResults.
                                                       goto()
                                                   ])
                                        ])
                                ])
                            ])
                 ])
         ])
示例#16
0
 def create():
     return Input(
         grammar=Grammar(items=["more", "$ more", "$ next", "$ forward"]),
         children=[
             Action(var_name="Show_Next", operator="SET_TO_YES"),
             PageAction.set_to_next(),
             Output(
                 Prompt(items=["Okay."]),
                 children=[
                     Output(Prompt(
                         "\"{Search_Now:\"{Search_Now}\", Color:\"{Color_Preference}\", Style:\"{Style_Preference}\", Index:\"{Current_Index}\", Page:\"{Page}\", Total_Movies:\"{%s}\", Total_Pages:\"{Total_Pages}\"}\""
                         % NAME_RESULTS_COUNT),
                            children=[
                                Action(var_name="First_Results",
                                       operator="SET_TO_NO"),
                                GetUserInput(
                                    _id="getUserInput_2503174",
                                    children=[
                                        Input(
                                            grammar=Grammar(items=[
                                                "UPDATE CURRENT_INDEX"
                                            ]),
                                            children=[
                                                Action(
                                                    var_name="Show_Next",
                                                    operator="SET_TO_NO"),
                                                Action(
                                                    var_name="Show_Previous",
                                                    operator="SET_TO_NO"),
                                                If(elements=[
                                                    Condition(
                                                        name="Last_Results",
                                                        operator=
                                                        "EQUAL_TO_YES"),
                                                    Output(prompt=Prompt(
                                                        items=
                                                        "Those were the last results"
                                                    ),
                                                           children=[
                                                               Goto(
                                                                   ref=
                                                                   "profileCheck_2503183"
                                                               )
                                                           ])
                                                ]),
                                                If(elements=[
                                                    Condition(
                                                        name="Current_Index",
                                                        operator="EQUALS",
                                                        root_text="{%s}" %
                                                        NAME_RESULTS_COUNT),
                                                    Output(
                                                        prompt=Prompt(
                                                            items=[
                                                                "Here are the last results"
                                                            ]),
                                                        children=[
                                                            Action(
                                                                var_name=
                                                                "Last_Results",
                                                                operator=
                                                                "SET_TO_YES"
                                                            ),
                                                            Goto(
                                                                ref=
                                                                "profileCheck_2503183"
                                                            )
                                                        ])
                                                ]),
                                                Output(
                                                    prompt=Prompt(items=[
                                                        "Here is the next set of results"
                                                    ]),
                                                    children=[
                                                        If(elements=[
                                                            StyleConditions.
                                                            is_blank(),
                                                            ColorConditions.
                                                            has_value(),
                                                            Output(
                                                                prompt=
                                                                Prompt(items=[
                                                                    "for {Style_Preference} {Color_Preference}-rated movies."
                                                                ]),
                                                                children=[
                                                                    AfterSearchResults
                                                                    .goto()
                                                                ])
                                                        ],
                                                           _id=
                                                           "profileCheck_2503183"
                                                           ),
                                                        If(elements=[
                                                            ColorConditions.
                                                            is_blank(),
                                                            StyleConditions.
                                                            has_value(),
                                                            Output(
                                                                Prompt(
                                                                    items=[
                                                                        "for {Recency_Preference} {Genre_Preference} movies."
                                                                    ]),
                                                                children=[
                                                                    AfterSearchResults
                                                                    .goto()
                                                                ])
                                                        ]),
                                                        If(elements=[
                                                            ColorConditions.
                                                            is_blank(),
                                                            StyleConditions.
                                                            is_blank(),
                                                            Output(
                                                                prompt=
                                                                Prompt(items=[
                                                                    "for ALL {Recency_Preference} movies."
                                                                ]),
                                                                children=[
                                                                    AfterSearchResults
                                                                    .goto()
                                                                ])
                                                        ]),
                                                        Output(Prompt(items=[
                                                            "for {Recency_Preference} {Certification_Preference}-rated {Genre_Preference} movies."
                                                        ]),
                                                               children=[
                                                                   AfterSearchResults
                                                                   .goto()
                                                               ])
                                                    ])
                                            ])
                                    ])
                            ])
                 ])
         ])
示例#17
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()
                                            ])
                                 ])
                         ])
                 ])
         ])