Introduction to Computational Linguistics
Introduction to Computational Linguistics
Introduction to Computational Linguistics
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
17. Using Finite State Transducers 64<br />
In general, backtracking works as follows. Every time we face a choice, we pick<br />
the available transition with the smallest number. If we backtrack we go back in<br />
the run <strong>to</strong> the point where there was a choice, and then we change the previously<br />
chosen next transition <strong>to</strong> the next up. From that point on we consistently choose<br />
the least numbers again. This actually enumerates all runs. It is sometimes a<br />
dangerous strategy since we need <strong>to</strong> guarantee that the run we are following actually<br />
terminates: this is no problem here, since every step consumes at least one<br />
character.<br />
Important in backtracking is that it does not give the solutions in one blow:<br />
it gives us one at a time. We need <strong>to</strong> memorize only the last run, and then backtracking<br />
gives us the next if there is one. (If there is none, it will tell us. Basically,<br />
there is none if going back we cannot find any point at which there was a choice<br />
(because you can never choose lower number than you had chosen).)<br />
Now let us look at the other strategy. It consists in remembering partial runs,<br />
and trying <strong>to</strong> complete them. A partial run on a pair of strings simply is a sequence<br />
of transitions that sucessfully maps the machine in<strong>to</strong> some state, consuming some<br />
part of the input string and some part of the outpu string. We do not require that<br />
the partial run is part of a successful run, otherwise we would require <strong>to</strong> know<br />
what we are about <strong>to</strong> find out: whether any of the partial runs can be completed.<br />
We start with a single partial run: the empty run — no action taken. In the first<br />
step we list all transitions that extend this by one step. There is only one, t(0). So,<br />
the next set of runs is t(0). It leads <strong>to</strong> the situation 1, a|aa : b|bbb. From here we<br />
can do two things: t(1) or t(2). We do both, and note the result:<br />
(169)<br />
Step 2<br />
t(0), t(1) : 1, aa|a : b|bbb<br />
t(0), t(2) : 1, a|aa : bb|bb<br />
In the next round we try <strong>to</strong> extend the result by one more step. In each of the two,<br />
we can perform either t(1) or t(2):<br />
(170)<br />
Step 3<br />
t(0), t(1), t(1) : 1, aaa| : b|bbb<br />
t(0), t(1), t(2) : 1, aa|a : bb|bb<br />
t(0), t(2), t(1) : 1, aa|a : bb|bb<br />
t(0), t(2), t(2) : 1, a|aa : bbb|b