previous | start | next

Speech Grammars

Offer more natural conversations than simple keywords:

Variants for yes/no questions, e.g.

    yes | no;
    yes=("yes" | "sure" | "ok" | "fine") {$answer=true};
    no=("no" | "forget it" | "no way") {$answer=false};
<grammar name="flight" timeout="4">
  intro ((to|dest) from?)| (from (to|dest)?) polite?;
  intro = ("I want"|"I would like") ("to fly"|"a flight");
  polite = "please"|"thanks"|"thank you";
  to = ("going"|"flying")? "to" airport;
       (leave? departure)? {dest=airport};
  dest = "arriving" (arrival atdest?)|(atdest arrival?)
     ("and" from)?;
  arrival = "on" date {arrival=date};
  atdest = "at" airport {to=airport};
  from = leave? (origin departure?)|(departure origin)
     ("and"? (dest|to))?;
  origin = "from" airport {from=airport};
  departure = "on" date {departure=date};
  leave = "departing" | "leaving";
  date = <rule name="date"/>;
  airport = <rule name="airport"/>;
</grammar>

Which permits the user to say things like:

Special built-in productions for numbers, dates, currency values, etc.

Application variables set by grammar rules are used to control subsequent behavior.

Bottom-up parsing of spoken response could be used in principle to apply the grammar rules for partial understanding



previous | start | next