Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Carey Brown
  • Frits Walraven

help with script

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using this in a siriproxy plugin. Can someone help me? I can't pass the variable {station} in the nested "if" statement:

listen_for /(Turn on the TV|Turn the TV on|Put on the TV|Put the TV on|Turn on the television|Turn the television on|Put the television on|Put on the television)/i do
response = ask "Which one? Say upstairs or downstairs..." #ask the user for something

if(response =~ /upstairs/i) #process their response
say "Turning the Bedroom TV on"
puts %x{/home/siri/SiriProxy/ Entrance Upstairs TV}
elsif(response =~ /downstairs/i) #process their response
say "Turning the Living Room TV on"
puts %x{/home/siri/SiriProxy/ Entrance Downstairs TV}
response = ask "Which Channel? Say the three letters of the station, such as NBC"
if(response =~ /station ([A-Za-z]+))/i |station|
say "Putting on: #{station}"
puts %x{/home/siri/SiriProxy/ Channel #{station} DN}
elsif(response =~ /I don't know/i)
say "Putting it on"
puts %x{/home/siri/SiriProxy/ Channel NBC DN}
say "That didn't make any sense"
say "I didn't understand your response"

request_completed #always complete your request! Otherwise the phone will "spin" at the user!
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic