| 92 | |
| 93 | |
| 94 | === Run script as service and use TTS in script |
| 95 | |
| 96 | Detect variables in dialog, pass them to script and let script use TTS to say answer. |
| 97 | |
| 98 | {{{ |
| 99 | u:("[řekni ukaž zobraz najdi] {mi} [odjezdy spoje] ze zastávky _~station_name") |
| 100 | ^call(DialogKordisbot.say_answer1($1)) |
| 101 | }}} |
| 102 | |
| 103 | Dialog detect word with station name and calls {{{say_answer1()}}}. No answer is passed back, answer is said directly in script. |
| 104 | |
| 105 | {{{#!python |
| 106 | def say_answer1(self, station): |
| 107 | #get data finalDepartures |
| 108 | answer_msg = "First line {} goes to {} at {}, second line {} goes to {} at {}, third line {} goes to {} at {}".format(finalDepartures[0][0], finalDepartures[0][1], finalDepartures[0][2], finalDepartures[1][0], finalDepartures[1][1], finalDepartures[1][2], finalDepartures[2][0], finalDepartures[2][1], finalDepartures[2][2]) |
| 109 | |
| 110 | self.s.ALAnimatedSpeech.say(answer_msg) |
| 111 | }}} |
| 112 | |
| 113 | |
| 114 | == Examples |
| 115 | |
| 116 | Explore example applications in {{{/nlp/projekty/pepper/myapps}}}: |
| 117 | * kordisbot |
| 118 | * sport_bot |
| 119 | * rozvrh |