Changes between Version 7 and Version 8 of en/ProgrammingRobotsCourse/GettingWwwInfo


Ignore:
Timestamp:
Oct 28, 2019, 5:09:38 PM (4 years ago)
Author:
xrambous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • en/ProgrammingRobotsCourse/GettingWwwInfo

    v7 v8  
    7777}}}
    7878
    79 {{{u1}}} detects letter and number (concepts defined earlier in dialog) and calls get_current_lesson(). This function return strings, that are parsed in dialog and answer is translated to each locale.
     79{{{u1}}} detects letter and number (concepts defined earlier in dialog) and calls {{{get_current_lesson()}}}. This function return strings, that are parsed in dialog and answer is translated to each locale.
    8080
    8181{{{#!python
     
    9090            return "In %s currently %s" % (lesson.room, lesson.name)
    9191}}}
     92
     93
     94=== Run script as service and use TTS in script
     95
     96Detect variables in dialog, pass them to script and let script use TTS to say answer.
     97
     98{{{
     99u:("[řekni ukaž zobraz najdi] {mi} [odjezdy spoje] ze zastávky _~station_name")
     100    ^call(DialogKordisbot.say_answer1($1))
     101}}}
     102
     103Dialog detect word with station name and calls {{{say_answer1()}}}. No answer is passed back, answer is said directly in script.
     104
     105{{{#!python
     106def 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
     116Explore example applications in {{{/nlp/projekty/pepper/myapps}}}:
     117 * kordisbot
     118 * sport_bot
     119 * rozvrh