Ejemplo n.º 1
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")
         ])
Ejemplo n.º 2
0
 def create():
     return Input(
         grammar=Grammar(
             watson_items=[
                 "all items",
                 "$ all items",
                 "$ all results"
             ]
         ),
         children=[
             CurrentIndexAction.set_to_zero(),
             PageAction.set_to_new(),
             StylePreferenceAction.set_to_blank(),
             ColorPreferenceAction.set_to_blank(),
             Goto(ref="output_ok_do_search")
         ]
     )
Ejemplo n.º 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")
         ]
     )
Ejemplo n.º 4
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")
         ]
     )
Ejemplo n.º 5
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()
         ]
     )
Ejemplo n.º 6
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()
             ]
     )
Ejemplo n.º 7
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()]
                                     )
                                 ]
                             )
                         ]
                     )
                 ]
             )
         ]
     )
Ejemplo n.º 8
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()
                                            ])
                                 ])
                         ])
                 ])
         ])