13.11.2014 Views

Introduction to Computational Linguistics

Introduction to Computational Linguistics

Introduction to Computational Linguistics

SHOW MORE
SHOW LESS

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 62<br />

0 −→ a:b 1 and then 1 −→ ε:b<br />

1 and 1 −→ a:ε<br />

1. Now, for the pair aaa and bbbb there are<br />

several runs:<br />

(163)<br />

0 a:b −→ 1 a:ε<br />

−→ 1 a:ε<br />

−→ 1 ε:b<br />

−→ 1 ε:b<br />

−→ 1 ε:b<br />

−→ 1<br />

0 a:b −→ 1 a:ε<br />

−→ 1 ε:b<br />

−→ 1 a:ε<br />

−→ 1 ε:b<br />

−→ 1 ε:b<br />

−→ 1<br />

0 a:b −→ 1 ε:b<br />

−→ 1 a:ε<br />

−→ 1 a:ε<br />

−→ 1 ε:b<br />

−→ 1 ε:b<br />

−→ 1<br />

0 a:b −→ 1 ε:b<br />

−→ 1 a:ε<br />

−→ 1 ε:b<br />

−→ 1 a:ε<br />

−→ 1 ε:b<br />

−→ 1<br />

(There are more runs that shown.) In the case of the machine just shown, the<br />

number of runs grows with the size of the input/output pair. There is therefore no<br />

hope of fixing the number of runs a priori.<br />

Despite all this, we want <strong>to</strong> give algorithms <strong>to</strong> answer the following questions:<br />

☞ Given a transducer T and a pair ⃗x : ⃗y of strings, is there a run of T that<br />

accepts this pair? (That is <strong>to</strong> say: is 〈⃗x,⃗y〉 ∈ R T ?)<br />

☞ Given ⃗x, is there a string ⃗y such that 〈⃗x,⃗y〉 ∈ R T ?<br />

☞ Given ⃗x, is there a way <strong>to</strong> enumerate R T (⃗x), that is <strong>to</strong> say, all ⃗y such that<br />

〈⃗x,⃗y〉 ∈ R T ?<br />

Let us do these questions in turn. There are two ways <strong>to</strong> deal with nondeterminism:<br />

we follow a run <strong>to</strong> the end and backtrack on need (depth first analysis); or we<br />

s<strong>to</strong>re all partial runs and in each cycle try <strong>to</strong> extend each run if possible (breadth<br />

first search). Let us look at them in turn.<br />

Let is take the second machine. Assume that the transitions are numbered:<br />

(164)<br />

(165)<br />

(166)<br />

t(0) = 〈0, a, 1, b〉<br />

t(1) = 〈1, a, 1, ε〉<br />

t(2) = 〈1, ε, 1, b〉<br />

This numbering is needed <strong>to</strong> order the transitions. We start with the initial state<br />

0. Let input aaa and output bbbb be given. Initially, no part of input or output<br />

is read. (Output is at present a bit of a misnomer because it is part of the input.)<br />

Now we want <strong>to</strong> look for a transition that starts at the state we are in, and matches

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!