示例#1
0
    def create():
        return Folder(
            label="UI ACTIONS",
            children=[
                Input(
                    Grammar(watson_items=["USER CLICKS BOX"]),
                    children=[
                        Output(
                            prompt=Prompt(
                                items=["{Selected_Movie}."]
                            ),
                            children=[
                                If(
                                    elements=[
                                        Condition(name="Popularity_Score", operator="GREATER_THEN", root_text="6.9"),
                                        Output(
                                            Prompt(
                                                items=[
                                                    "Great choice! That gets fabulous ratings.",
                                                    "That's a good one! You will love it.",
                                                    " I hear that's a really good movie!"
                                                ]
                                            ),
                                            children=[AfterSearchResults.goto()]
                                        )
                                    ]
                                ),
                                If(
                                    elements=[
                                        Condition(name="Popularity_Score", operator="LESS_THEN", root_text="4"),
                                        Output(
                                            Prompt(
                                                items=[
                                                    "Hmm, I hear that's not such a great movie.",
                                                    "Um, that one gets low ratings.",
                                                    "Are you sure about that? The ratings are terrible."
                                                ]
                                            ),
                                            children=[AfterSearchResults.goto()]
                                        )

                                    ]
                                ),
                                Output(
                                    prompt=Prompt(
                                        items=[
                                            "Okay.",
                                            "All right.",
                                            "Sure thing!",
                                            "Coming right up!"
                                        ]
                                    ),
                                    children=[AfterSearchResults.goto()]
                                )
                            ]
                        )
                    ]
                )
            ]
        )
示例#2
0
 def create():
     return If(
         _id=StylePreferenceProfileCheck.__id(),
         elements=[
             StyleConditions.is_blank(),
             Output(
                 Prompt(items=["Do you prefer a certain style? "]),
                 children=[
                     If(
                         elements=[
                             Condition(name="First_Time", operator="EQUAL_TO_YES"),
                             Output(
                                 Prompt(
                                     items=[
                                         "<mct:link><b><mct:input>High heels</mct:input></b></mct:link>\n<mct:link><b><mct:input>Boots</mct:input></b></mct:link>\n<mct:link><b><mct:input>Sandals</mct:input></b></mct:link>\n<mct:link><b><mct:input>Trainers</mct:input></b></mct:link>\n<mct:link><b><mct:input>No Preference</mct:input></b></mct:link>", ]
                                 ),
                                 children=[StylePreferenceProfileCheckInput.goto()]
                             )
                         ]
                     ),
                     StylePreferenceProfileCheckInput.create()
                 ]
             )
         ]
     )
示例#3
0
 def too_much_small_talk_goto():
     return If(
         elements=[
             Condition(name="Small_Talk_Count", operator="GREATER_THEN", root_text="2"),
             Goto(ref="output_too_much_small_talk")
         ]
     )
示例#4
0
 def is_blank():
     return Condition(name="Style_Preference", operator="IS_BLANK")
示例#5
0
 def has_value():
     return Condition(name="Style_Preference", operator="HAS_VALUE")
示例#6
0
 def is_blank():
     return Condition(name=NAME_USER_NAME, operator="IS_BLANK")
示例#7
0
 def is_greater_then(value):
     return Condition(name=NAME_OUT_OF_SCOPE_COUNT,
                      operator="GREATER_THEN",
                      root_text=value)
示例#8
0
 def is_yes():
     return Condition(name=NAME_FIRST_TIME, operator="EQUAL_TO_YES")
示例#9
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()
                                                               ])
                                                    ])
                                            ])
                                    ])
                            ])
                 ])
         ])
示例#10
0
 def is_no():
     return Condition(name=NAME_TERMINAL_EXCHANGE, operator="EQUAL_TO_NO")
示例#11
0
 def equals_zero():
     return Condition(name=NAME_RESULTS_COUNT,
                      operator="EQUALS",
                      root_text="0")
示例#12
0
 def less_than(value):
     return Condition(name=NAME_RESULTS_COUNT,
                      operator="LESS_THEN",
                      root_text=value)
示例#13
0
 def create():
     return Folder(
         selection_type="RANDOM",
         label="OPENING SEQUENCES",
         children=[
             Input(
                 GenericGrammar.create_hello(),
                 children=[
                     GreetingAction.create_increment(),
                     If(elements=[
                         Condition(name=NAME_TERMINAL_EXCHANGE,
                                   operator="EQUAL_TO_YES"),
                         Goto(ref="output_welcome_back")
                     ]),
                     If(match_type="ANY",
                        elements=[
                            Condition(name=NAME_GREETING_COUNT,
                                      operator="GREATER_THEN",
                                      root_text="2"),
                            Condition(name=NAME_SMALL_TALK_COUNT,
                                      operator="GREATER_THEN",
                                      root_text="2"),
                            Goto(ref="output_end_of_small_talk")
                        ]),
                     Output(
                         Prompt(items=["Hello.", "Hi.", "Hi there."]),
                         children=[
                             Output(
                                 _id="output_how_are_you",
                                 prompt=Prompt(items=[
                                     "How are you today?",
                                     "How are you feeling today?",
                                     "How is it going?"
                                 ]),
                                 children=[
                                     GetUserInput(children=[
                                         Input(Grammar(watson_items=[
                                             "Movies",
                                             "$ (STYLE)={Style_Preference}",
                                             "$ (COLOR)={Color_Preference}",
                                             "$ movies"
                                         ]),
                                               children=[
                                                   Goto(
                                                       ref=
                                                       "input_main_search_criteria"
                                                   )
                                               ]),
                                         Input(
                                             FeelingGrammar.
                                             create_not_so_good(),
                                             children=[
                                                 Goto(
                                                     ref=
                                                     "output_sorry_to_hear_that"
                                                 )
                                             ]),
                                         Input(
                                             FeelingGrammar.
                                             create_not_so_bad(),
                                             children=[
                                                 Goto(ref=
                                                      "output_good_to_hear")
                                             ]),
                                         Input(
                                             FeelingGrammar.
                                             create_feeling_fine(),
                                             children=[
                                                 Output(
                                                     _id=
                                                     "output_good_to_hear",
                                                     prompt=Prompt(items=[
                                                         "Good to hear! <br> <br>"
                                                     ]),
                                                     children=[
                                                         HowCanHelpYouOutput
                                                         .goto()
                                                     ])
                                             ]),
                                         Input(
                                             FeelingGrammar.
                                             create_feeling_great(),
                                             children=[
                                                 Output(Prompt(items=[
                                                     "Fantastic! So glad to hear it. <br> <br>"
                                                 ]),
                                                        children=[
                                                            HowCanHelpYouOutput
                                                            .goto()
                                                        ])
                                             ]),
                                         Input(
                                             FeelingGrammar.
                                             create_feeling_bad(),
                                             children=[
                                                 Output(
                                                     _id=
                                                     "output_sorry_to_hear_that",
                                                     prompt=Prompt(items=[
                                                         "I'm sorry to hear that. <br> <br>"
                                                     ]),
                                                     children=[
                                                         HowCanHelpYouOutput
                                                         .goto()
                                                     ])
                                             ]),
                                         PreliminarySequencesSearch.goto()
                                     ])
                                 ])
                         ])
                 ]),
             Input(
                 Grammar(watson_items=[
                     "How are you", "$ how have you been doing",
                     "$ how is it going", "$ how are you",
                     "$ what's shaking", "$ what's up"
                 ]),
                 children=[
                     GreetingAction.create_increment(),
                     If(elements=[
                         Condition(name=NAME_GREETING_COUNT,
                                   operator="GREATER_THEN",
                                   root_text="2"),
                         Condition(name=NAME_SMALL_TALK_COUNT,
                                   operator="GREATER_THEN",
                                   root_text="2"),
                         Output(
                             _id="output_end_of_small_talk",
                             prompt=Prompt(items=[
                                 "You're very polite, but don't you want me to look up movies for you?"
                             ]),
                             children=[
                                 GetUserInput(children=[
                                     Input(GenericGrammar.yes(),
                                           children=[
                                               StylePreferenceProfileCheck.
                                               goto()
                                           ]),
                                     Input(GenericGrammar.no(),
                                           children=[
                                               GreetingAction.reset(),
                                               Output(
                                                   GenericPrompt.ok_fine())
                                           ]),
                                     Input(GenericGrammar.ok(),
                                           children=[
                                               StylePreferenceProfileCheck.
                                               goto()
                                           ]),
                                     PreliminarySequencesSearch.goto()
                                 ])
                             ])
                     ]),
                     Input(Grammar(watson_items=[
                         "Fine", "$ excellent", "$ outstanding",
                         "$ fabulous", "$ terrific", "$ not good",
                         "$ not so good", "$ not well", "$ not so well",
                         "$ terrible", "$ awful", "$ worst", "$ bored",
                         "$ sad", "$ good", "$ well", "$ fine", "$ thirsty",
                         "$ hungry", "$ tired"
                     ]),
                           children=[
                               Output(Prompt(
                                   items=["I am doing well, thanks."]),
                                      children=[HowCanHelpYouOutput.goto()])
                           ]),
                     Output(Prompt(items=["I am doing well, thanks."]),
                            children=[Goto(ref="output_how_are_you")])
                 ]),
             Input(
                 Grammar(watson_items=[
                     "Nice to meet you", "$ nice to meet you",
                     "$ pleasure to meet you", "$ make your acquaintance"
                 ]),
                 children=[
                     If(elements=[
                         Condition(name="Greeting_Count",
                                   operator="GREATER_THEN",
                                   root_text="2"),
                         Output(Prompt(items=[
                             "You're very polite, but don't you want me to look up movies for you?"
                         ]),
                                children=[
                                    GetUserInput(children=[
                                        Input(
                                            GenericGrammar.yes(),
                                            children=[
                                                StylePreferenceProfileCheck.
                                                goto()
                                            ]),
                                        Input(GenericGrammar.no(),
                                              children=[
                                                  GreetingAction.reset(),
                                                  Output(GenericPrompt.
                                                         ok_fine())
                                              ]),
                                        Input(
                                            GenericGrammar.ok(),
                                            children=[
                                                StylePreferenceProfileCheck.
                                                goto()
                                            ]),
                                        PreliminarySequencesSearch.goto()
                                    ])
                                ])
                     ]),
                     Output(Prompt(
                         items=["Nice to meet you too, {User_Name}!"]),
                            children=[HowCanHelpYouOutput.goto()])
                 ])
         ])
示例#14
0
 def is_blank():
     return Condition(name=NAME_COLOR_PREFERENCE, operator="IS_BLANK")
示例#15
0
 def has_value():
     return Condition(name=NAME_COLOR_PREFERENCE, operator="HAS_VALUE")
示例#16
0
 def is_yes():
     return Condition(name=NAME_TERMINAL_EXCHANGE, operator="EQUAL_TO_YES")
示例#17
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()
                                                   ])
                                        ])
                                ])
                            ])
                 ])
         ])