суббота, 4 июля 2009 г.

Examples

Parsing. Let's try to illustrate and explain the difference between parsing top-down and bottom-up by the example sentence "They are flying planes" and a simple grammar, presented in the form of numbered rules:
1. S ® NP VP
2. NP ® N
3. NP ® PRO
4. NP ® ADJ N
5. VP ® VT NP
6. VT ® V
7. VT ® AUX V
8. N ® planes
9. PRO ® they
10. ADJ ® flying
11. AUX ® are
12. V ® are
13. V ® flying

Background are shown on the right side, and investigation - to the left. For example, Rule 1 reads as follows: "If the sequence consists of a nominal group (NP), followed by the verbal group (VP), then this sequence is a sentence (S)."
Syntax parsing top-down begins with the symbol S, which will be the tops of trees indiscriminately. This procedure is equivalent to the procedure of a problem, which is to determine whether a sequence of words offer. Rule 1 states that each proposal is the name of the group (NP), followed by the verbal group (VP). If you have multiple rules, the first thing applies to the lowest number, then it expands from left to right. Thus the next step is to find the first communication, ie NP. First, rule 2 is activated, and then to 8 (Fig. 2a). Since "Planes" are not consistent with the "they", the algorithm is triggered again, and now the first 3 to be activated, and then to 9. Then the algorithm returns to rule 1 and the next goal put the definition of VP. First, activated rules 5, 6, and 12 (Fig. 2b). Further progress in parsing otrzhen in Figure 2 (c, d, e).

Комментариев нет:

Отправить комментарий