Presentation is loading. Please wait.

Presentation is loading. Please wait.

Parsing: Features & ATN & Prolog By

Similar presentations


Presentation on theme: "Parsing: Features & ATN & Prolog By"— Presentation transcript:

1 Parsing: Features & ATN & Prolog By rmana@um.edu.my http://fsktm.um.edu.my/~rohana

2 Feature System CFG – inconvenient for capturing NL. CFG – inconvenient for capturing NL. Most NL are often agreement restrictions between words and phrases. Most NL are often agreement restrictions between words and phrases. For example: For example: –*a men (a man) : a indicates single object while the noun men indicates a plural object –The noun phrase does not satisfy the Number Agreement restriction of English Other forms of agreements: Other forms of agreements: –Subject-verb –Gender agreement for pronouns –Restriction between the head of a phrase & the form of its complement

3 Feature System cont. To handle such phenomena: To handle such phenomena: –Grammatical formalism is extended to allow constituent to have Features –Eg: define a feature NUMBER that may take a value of either s (singular) or p (plural).

4 Augmented Transition Network (ATN) RTN –> add features = ATN RTN –> add features = ATN The features are called Registers The features are called Registers Constituent structures are created by allowing each network to have a set of registers. Constituent structures are created by allowing each network to have a set of registers.

5 ATN processes When a network is pushed, a new set of registers is created When a network is pushed, a new set of registers is created As the network is traversed, the registers are set to values by actions associated with each arc. As the network is traversed, the registers are set to values by actions associated with each arc. When the network is popped, the register are assembled to form a constituent structure, with the CAT slot being the network name When the network is popped, the register are assembled to form a constituent structure, with the CAT slot being the network name

6 Example ATN Grammar Example Grammar 4.11 (pg 102, Allen) & 4.12 Example Grammar 4.11 (pg 102, Allen) & 4.12

7 Grammar & Logic Programming Another popular method is to encode the rules of grammar into logic programming language such as Prolog. Another popular method is to encode the rules of grammar into logic programming language such as Prolog. Prolog uses the same search strategy: depth first top-down parsing algorithm Prolog uses the same search strategy: depth first top-down parsing algorithm Just need to reformulate CFG as clauses in PROLOG Just need to reformulate CFG as clauses in PROLOG

8 Example S -> NP VP S -> NP VP S(P1,P3):- np(P1,P2), vp(P2,P3). S(P1,P3):- np(P1,P2), vp(P2,P3). –Axiom: “There is an S between position 1 and position 3, if there is a position p2 such that there is an NP between p1 and p2 and a VP between p2 and p3”. Add axioms listing the words in the sentence (‘John ate the cat’) by their position: Add axioms listing the words in the sentence (‘John ate the cat’) by their position: –word(john,1,2). –word(ate,2,3). –word(the,3,4). –word(cat,4,5).

9 Example cont. The Lexicon is defined by a set of predicates: The Lexicon is defined by a set of predicates: –isart(the). –isname(john). –isverb(ate). –isnoun(cat). Ambiguous words would produce multiple assertions – one for each syntactic category to which they belong

10 Example cont. For each syntactic category, define a predicate that is true only if the word between the two specified positions is of that category, for example: For each syntactic category, define a predicate that is true only if the word between the two specified positions is of that category, for example: –n(I,O):- word(Word,I,O), isnoun(Word). –art(I,O):- word(Word,I,O), isart(Word). –v(I,O):- word(Word,I,O), isverb(Word). –name(I,O):- word(Word,I,O), isname(Word).

11 Prolog-based Parsing Prove that “John ate the cat” is a legal sentence. Prove that “John ate the cat” is a legal sentence. ie. Prove : S(1,5). ie. Prove : S(1,5). Refer the tracing example in page 74, Allen Refer the tracing example in page 74, Allen


Download ppt "Parsing: Features & ATN & Prolog By"

Similar presentations


Ads by Google