• Aucun résultat trouvé

Phrase Class n -gram

5.5 Viterbi Search

5.6.2 Upper Bound Bigram

In order to have an admissible A search we need to compute a word bigram model, for the Viterbi search, which guarantees that the scores assigned by this model are always an upper bound of the scores assigned by the pcng model. This bigram-like model will

not

be a proper language model, as its probability mass can in general sum to more than 1. This is not a problem for the Viterbi search { i.e., we can still use the model because we are not using the answer paths that come from the Viterbi search as our answer. Thus, we will not refer to it as a bigram model, and simply call it a functionfu(w1;w2) which returns a number between 0 and 1 such that for every possible word sequenceW = w1:::wN:

NY,1

i=1 fu(wi;wi+1) ^P(w1;:::;wN)

where ^P(w1;:::;wN) is the probability that the pcng model assigns to the word sequence. The word pairwise product of fu must be greater than or equal to the probability assigned by the pcng model.

Furthermore, we would like the upper bound to be astightas possible in the inter-est of eciency for the A search. This upper bound function fu must be computed as a function of the grammar and rule probabilities and of the n-gram component of

107

the pcng model.

We can examine some simple cases rst. If the grammar has no rules, and we are looking at a trigram model, then the pcng model reduces to a simple word trigram model, such that the probability of a word depends on the previous two words. Computing fu in this case is quite simple:

fu(w1;w2) = maxw

0

^P(w2 jw0;w1)

Since the upper bound function fu has no knowledge of which word preceded word w1 when looking at the word sequence w1 w2, it must assume the worst, or assume that it was the wordw0 that allows maximal probability of w2 given w0 and w1. The quadgram case is similar, except the maximization is computed over all word pairs.

If we begin to add rules to the grammar, the situation becomes more complicated as there is more freedom in how we set fu. For example, consider a grammar which contains only the two rules:

NT0 )one way [0.6]

NT0 )round trip [0.4]

If the pcng model is using a bigram model, for simplicity, fu(w1;w2) could just be set to ^P(w2 jw1) for all bigramsnot involving the words \one", \way", \round", and

\trip". For any bigram involving one of these words we must consider all possible ways that the two above rules might apply to some sentence with that pair of words, and choose that parse which allocates the most probability to this pair of words as the value forfu. For example, considerfu(the;one). \One" could be the start of NT0 with the rst rule applying, or it could be just the word \one" not then followed by

\way". These two cases need to be separately considered to decide how each of them would allocate probability to the pair of words.

This notion can be applied recursively to handle grammars with more rules and deeper recursion in these rules. The general algorithm functions as follows. It will make two passes. In the rst pass, it examines all non-terminals in the grammars and recursively computes which bigrams could be derived by these non-terminals along

108

with the portion of the probability mass that should be allocated to these bigrams.

For example, with the rules:

NT0 )one way [0.6]

NT0 )round trip [0.4]

NT1 )NT0 ight [0.5]

NT1 )earliest NT0 ight [0.25]

NT1 )cheapest NT0 fare [0.25]

NT0 would be record f(one way), (round trip)g as the bigrams it could derive, and NT1 would recordf(one way), (round trip), (way ight), (trip ight), (way fare), (way ight), (earliest one), (earliest round), (cheapest one), (cheapest round)g. These sets of bigrams are recursively computed. To divide the probability evenly we take thenth root of the probability for a given rule whose right hand side is length n and divide it evenly among all elements on the right-hand-side of that rule. This is equivalent to dividing the log probability by n.

Once this rst pass is complete, each non-terminal has a list of the bigrams for which it can be responsible. For the second pass, we examine all n-gram sequences which occurred during training. For each of these, if a non-terminal is involved we compute how much probability should be allotted to all the bigrams derivable from that non-terminal, and maximize this over all possible n-gram sequences. We repeat this for the (n,1),gram, etc, all the way to the unigram model.

We have some empirical results of this upper bound model, as shown in Figure 5-1. This gure shows a histogram representing how tight the upper bound model is per word in the test set. The mean of this plot is 0.61, which means on average the log probability (base e) assigned to a word by the upper bound function fu is 0.61 in excess of what the real pcng model assigns. The plot was made for a trigrampcng

model acquired after 190 merges of the standard inference run. Each sentence in our independent test set accounts for one element in the histogram.

Unfortunately, when we tested the performance of this system empirically, the A search could not even complete one utterance (within our patience limit, that is).

It spent all of its time extending partial paths, never completing a path. The A 109

0.5 1 1.5 2 0

20 40 60 80 100 120 140 160 180 200

Per Word Excess Logprob

Number of Sentences

Figure 5-1: Excess log probability for upper bound bigram model Per word excess log probability of functionfu for the phrase class trigram model.

search is far too sensitive to loose upper bounds, rendering this upper bound model impractical.