1.5.3. Instructions Syntax
In order to produce the instruction we need to define a syntax of how the instuction set should look. This is essentially a cannonical model that describes how words are put together using information from the route description. We will define the syntax using a version of the Backus-Naur-Form (BNF). This is a simple notation of encoding how sentences are structured.
Backus-Naur-Form - Elements
The main element in BNF is the
symbol. Symbols are defined using the syntax <SYMBOL_NAME>, where
SYMBOL_NAME is the name of a symbol you wish to describe. For example
<Start_Instruction>.
A symbol can be defined
using other symbols. Here, the definition is made using the notation ::= . Hence,
an expression in BNF can be thought of as an equation that relates one symbol to
a set of others.
We will use two other types of element in
the definitions. Strings are literal phrases that should be included. They will
be marked up using double quotes, e.g. "Start on". Objects will relate to the
geographic features encoded in the route description. There will be three types
of object - landmark, road and junction. They will be marked simply with the
word describing the type of object. To indicate a property of an object we will
use a . for example road.name indicates the name of a road.
Thus we might define a road link instruction as:
<Road_Link_Instruction> ::= "Continue
along" road.name "for" road.length "passing" landmark.name
which might then produce a text instruction such as:
"Continue along Werdmuehlestrasse for 200 metres
passing Spielzeug Museum".
Backus-Naur-Form - Operators
There are a number of useful
operators that we will also need to use. The most important is the "or" sign | .
This means that the instruction should use one of a number of options. ()
Brackets can be used to indicate a list of options.
For
example we could define a symbol:
<Turn_Indicator> ::= "turn" ("left" |
"right") "onto" road.name
which might be used to produce:
"turn left onto Werdmuehlestrasse".
Another operator is known as the Kleene star. The notation
is ( )* This indicates that a symbol
or set of symbols should be repeated. For example:
<Road_Link_Instruction> ::= "Continue
along" road.name "for" road.length "passing" (landmark.name "on your"
("left"|"right"))*
might be used to produce an instruction such as:
"Continue along Werdmuehlestrasse for 200 metres
passing Spielzeug Museum on your left, Museum Strauhof on your right".
Finally, we will use the optional operator which is
indicated using square brackets [ ]. This means that the definition in the
brackets is optional for the sentence. For example we might place the the
landmark part of the previous symbol in brackets since there may be no landmarks
found along a particular stretch of road, i.e.:
<Road_Link_Instruction> ::= "Continue
along" road.name "for" road.length ["passing" (landmark.name "on your"
("left"|"right"))*]
BNF Summary
Notation | Meaning |
---|---|
< > | A symbol element |
" " | A string element |
object | a road, junction or landmark object |
object.property | dot operator indicating an object property |
::= | Defines a symbol (is a) |
( ) | Seperates a set of elements |
| | or |
( )* | Repetition |
[ ] | Optional |
Generating Route Instructions
In this activity you will define the syntax of a set of route instructions using BNF and then apply these to the map that you chunked previously. This will allow you to write out a sequence of instructions using the features that are shown and named along the route depicted on the map. You can either use the start and end of the route shown or define your own somewhere along the route.
1) Formulate Instruction Syntax
You should start your syntax from
the following definition:
<Instruction_List>::=<Start_Instruction>
(<Junction_Node_Instruction>|<Road_Link_Instruction>)*
<Destination_Instruction>
which is to say a list of instructions consists of a
starting instruction followed by any number of junction or road instructions and
finally a destination instruction.
Expand out each of the
symbols to give them their own defintions. You will probably find it useful to
introduce some symbols of your own when doing this, e.g.
<Turn_Instruction>
2) Generate Natural Language Instructions
Generate instructions
for the route you previously chunked shown in the map. Your set of final
instructions should read something like:
"Set off from Bahnhofquai with Hauptbahnhof to your
right"
...
"Continue 1.5 kilometers along Waisenhausstrasse and
Werdmuehlestrasse passing Speilzeug museum on your right"
...
"At the Augustinerkircher turn right onto
Oetenbachgasse"
...
"Arrive at the Zuerichsee Pier"
3) Listen to Your Instructions
You can try listening to your instructions using an online Text-to-Speechengine. For example AT&T's Natural Voices, FestVox, German Festival or Cepstral.
What problems do you find with the conversion to speech? (Click here for more information)