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()] ) ] ) ] ) ] ) ] )
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() ] )