NLP: Augmented Transition Networks (ATNs), ATN Specification Language, ATN Parsing

690
-1

Published on

Augmented Transition Networks (ATNs), ATN Specification Language, ATN Parsing

Published in: Science, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
690
On Slideshare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

NLP: Augmented Transition Networks (ATNs), ATN Specification Language, ATN Parsing

  1. 1. Natural Language Processing Augmented Transition Networks (ATNs), ATN Specification Language, ATN Parsing Vladimir Kulyukin
  2. 2. Outline Augmented Transition Networks  ATN Specification Language  ATN Parsing 
  3. 3. Augmented Transition Networks
  4. 4. Limitations of CFGs Many elements in sentences must agree with each other across multiple components  Examples: 1. Whom did you write to yesterday?  2. This is the robot a guy I know built
  5. 5. Augmenting RTNs RTNs are equivalent to standard CFGs  Augmented Transition Networks (ATNs) extend RTN by adding registers where the network stores partial representations  ATN is, technically speaking, a network of subnetworks: some are considered higher-level and others lower-level  When a lower-level subnetwork finishes processing, the partial representation of the input is passed to a higher-level subnetwork via a register 
  6. 6. Augmenting RTNs ATNs also add structure building actions that manipulate contents of registers  The registers hold not just partial representations of the input but also arbitrary values  Arcs have associated with them actions and tests  ATNs are equivalent to Turning Machines in terms of their processing power 
  7. 7. Two Theorems Theorem 01: For every RTN, there is a PDA that accepts the same language Theorem 02: For every Turing machine M, there exists an ATN that accepts the same language Moll, R., Arbib, M., Kfoury. An Introduction to Formal Language Theory. Springer-Verlag.
  8. 8. ATN Specification Language Kleene star ( * ) to the right of a symbol indicates zero or more occurrences of that symbol  @ is the special register (contains the current word or a sub-tree (Woods uses *, but this is confusing, so we will use @ instead)  The left and right parentheses are used to indicate the beginning and end of a form  The vertical bar symbol ( | ) separates alternatives  The arrow symbol (  ) denotes the context-free rewrite operation 
  9. 9. ATN Specification 1. <transition network>  (<arc set><arc set>*) 2. <arc set>  (<state><arc>*) The first rule states that an ATN consists of a non-empty set of arcs (i.e., <arc set>)  The second rule states that an set of arcs begins with a state symbol (e.g., S, Q1, Q10/1, etc.) and a possibly empty set of arcs 
  10. 10. ATN Specification 3. <arc>  (CAT <category name><test><action>* <term act>) | (PUSH <state><test><action>* <term act>) | (TST <arbitrary label><test><action>* <term act>) | (POP <form><test>) An arc consists of an action symbol (i.e, CAT, PUSH, TST, and POP)  Rule 3 states that an arc can be one of the four types: CAT, PUSH, TST, and POP 
  11. 11. CAT Arc (CAT <category name><test><action>* <term act>) Follow the CAT arc if the current word’s category is the same as <category name> and the test <test> is satisfied  In Woods’ LISP-like notation, the test T means true, i.e., the test that is always true  If the <category name> and <test> conditions are satisfied, zero or more register actions can execute and exactly one term action (scanning next symbol or changing state) 
  12. 12. CAT Arc Example Format: (CAT <category name><test><action>* <term act>) Concrete Example: (CAT V T (SETR AUX NIL) (SETR V @) (TO Q4)) Follow the CAT arc if the current word’s category is V (Verb) and the test is always true ( T )  (SETR AUX NIL) set the value of the register AUX to NIL  (SETR V @) – set the value of the register V to the value of the register @  (TO Q4) – scan the word and go to state Q4 
  13. 13. PUSH Arc (PUSH <state><test><action>* <term act>) Follow the PUSH arc by pushing <state> to the stack (in the sense of a PDA) if <test> is satisfied  If <test> is satisfied and <state> has been pushed on to the stack, zero or more register actions can execute and exactly one term action (scanning next symbol or changing state) 
  14. 14. PUSH Arc Example Format: (PUSH <state><test><action>* <term act>) Example: (PUSH NP/ T (SETR SUBJ @) (TO Q3) If T is satisfied (and it is always satisfied), push NP/ on to the stack  (SETR SUBJ @) – set the value of the register SUBJ to the value of the register @  (TO Q3) – scan the next symbol and go to state Q3 
  15. 15. TST Arc (TST <arbitrary label><test><action>* <term act>) Run <test> and, if it is true, follow the arc specified by <arbitrary label>  Execute zero or more register actions specified by <action>* and exactly one term action (scanning next symbol or changing state) 
  16. 16. POP Arc (POP <form><test>) Run <test> and, if it is true, pop the form <form> off the stack  In general, <form> is a function applied to the contents of some registers 
  17. 17. TO & JUMP Arcs (TO <state>) (JUMP <state>) TO goes to state <state> and advances the input pointer to the next symbol  JUMP goes to state <state> and does not advance the input pointer 
  18. 18. GETF & GETR Arcs (GETF <feature>) (GETR <register>) GETF – stands for “get feature” and determines to value of some feature <feature> of the input word  GETR – gets the value of register <register> 
  19. 19. BUILDQ Arc (BUILDQ <fragment><register>*) BUILDQ – builds a pattern specified by <fragment> by placing into it the values in the sequence of registers specified by <register>* 
  20. 20. BUILDQ Example (BUILDQ (S+++(VP+)) TYPE SUBJ AUX V) (S+++(VP+)) is <fragment> (i.e., a pattern)  + is a place holder  <register>* is TYPE SUBJ AUX V  Execution of the this BUILDQ statement is as follows: take the value of register TYPE and replace 1st + with it; take the value of register SUBJ and replace 2nd + with it; take the value of register AUX and replace 3rd + with it; take the value of register V and replace the 4th + with it 
  21. 21. BUILDQ Example (BUILDQ (S+++(VP+)) TYPE SUBJ AUX V) Suppose TYPE stores symbol DCL (declarative)  Suppose SUBJ stores symbol ROBOT  Suppose AUX stores symbol CAN  Suppose V stores symbol RUN  Then the result of BUILDQ command is (S DCL ROBOT CAN (VP RUN)) 
  22. 22. APPEND & QUOTE Arc (APPEND <form><form>) (QUOTE <form> APPEND – appends two forms into a list  QUOTE – prevents form from being evaluated at run time (this is Lisp legacy so unless you use Lisp to implement ATNs, you do not have to worry about this arc) 
  23. 23. ATN Specification Language <transition network>  (<arc set><arc set>*) <arc set>  (<state><arc>*) <arc>  (CAT <category name><test><action>* <term act>) | (PUSH <state><test><action>* <term act>) | (TST <arbitrary label><test><action>* <term act>) | (POP <form><test>) <action>  (SETR <register><form>) | (SENDR <register><form>) | (LIFTR <register><form>) <term act>  (TO <state>) | (JUMP <state>) <form>  (GETR <register>) | @ | (GETF <feature>) | (BUILDQ <fragment> <register>*) | (LIST <form>*) | (APPEND <form> <form>) | (QUOTE <arbitrary structure>)
  24. 24. Sample ATN (S/ (PUSH NP/ T (SETR SUBJ @) (SETR TYPE (QUOTE DCL)) (TO Q1)) (CAT AUX T (SETR AUX @) (SETR TYPE (QUOTE Q)) (TO Q2))) (Q1 (CAT V T (SETR AUX NIL) (SETR V @) (TO Q4)) (CAT AUX T (SETR AUX @) (TO Q3)))
  25. 25. Sample ATN (Q2 (PUSH NP/ T (SETR SUBJ @) (TO Q3))) (Q3 (CAT V W (SETR V @) (TO Q4))) (Q4 (POP (BUILDQ (S+++ (VP +)) TYPE SUBJ AUX V) T) (PUSH NP/ T (SETR VP (BUILDQ (VP (V +) @) V)) (TO Q5))) (Q5 (POP (BUILDQ (S++++) TYPE SUBJ AUX VP) T) (PUSH PP/ T (SETR VP (APPEND (GETR VP) (LIST @))) (TO Q5)))
  26. 26. Parenthesized Representation of Parse Trees S VP NP N NP V cleans DET N the robot floor (S (NP (N robot)) (VP (V cleans) (NP (DET the) (N floor)))
  27. 27. ATN Example
  28. 28. ATN Example Does BOT_103 clean rooms? Start in state S/ and scan the first word in the sentence (input position pointer is shown with the blue arrow), i.e., Does  ATN can follow either NP/ or CAT  Following NP/ will fail  Let us assume then that ATN follows the CAT arc  (S/ (PUSH NP/ T (SETR SUBJ @) (SETR TYPE (QUOTE DCL)) (TO Q1)) (CAT AUX T (SETR AUX @) (SETR TYPE (QUOTE Q)) (TO Q2)))
  29. 29. ATN Example Does BOT_103 clean rooms? Let us assume then that ATN follows the CAT arc  ATN executes (SETR AUX @) and (SETR TYPE (QUOTE Q)) and (TO Q2)  (SETR AUX @) puts the value of @ (i.e., Does) into AUX  (SETR TYPE (QUOTE Q)) puts “Q” into AUX  (TO Q2) causes ATN to go to Q2 and advance the input pointer to BOT_103  (S/ (PUSH NP/ T (SETR SUBJ @) (SETR TYPE (QUOTE DCL)) (TO Q1)) (CAT AUX T (SETR AUX @) (SETR TYPE (QUOTE Q)) (TO Q2)))
  30. 30. ATN Example Does BOT_103 clean rooms? In Q2, there is only one transition on NP/  Execution of NP/ will successfully complete and place (NP BOT_103) into @  Next action is (SETR SUBJ @) places (NP BOT_103) into SUBJ  Then (TO Q3) is executed, which causes ATN to go to Q3 and advances the input pointer to clean  (Q2 (PUSH NP/ T (SETR SUBJ @) (TO Q3)))
  31. 31. ATN Example Does BOT_103 clean rooms? REGISTER CONTENTS: TYPE: Q AUX: BOT_103 SUBJ: (NP BOT_103)
  32. 32. ATN Example Does BOT_103 clean rooms? In Q3, the verb clean causes ATN to transition to state Q4 and sets the register V to clean and advances the input pointer to rooms  State Q4, execution of the POP arc is not successful because the end of the sentence is not reached  Execution of the NP/ arc succeeds and puts (NP rooms) to @  Then (SETR VP (BUILDQ (VP (V +) @) V)) is executed  (Q3 (CAT V T (SETR V @) (TO Q4))) (Q4 (POP (BUILDQ (S+++ (VP +)) TYPE SUBJ AUX V) T) (PUSH NP/ T (SETR VP (BUILDQ (VP (V +) @) V)) (TO Q5)))
  33. 33. ATN Example Does BOT_103 clean rooms? Then (SETR VP (BUILDQ (VP (V +) @) V)) is executed  The fragment is (VP (V +) @)  <register>* is V  So BUILDQ replaces + with the contents of the register V (clean) and replaces @ with its contents (i.e., (NP rooms))  The result structure is (VP (V clean) (NP rooms))  SETR places this structure into VP  ATN transitions to state Q5 and advances the input pointer to the end of the sentence 
  34. 34. ATN Example Does BOT_103 clean rooms? REGISTER CONTENTS: TYPE: AUX: SUBJ: V: VP: Q BOT_103 (NP BOT_103) clean (VP (V clean) (NP rooms)
  35. 35. ATN Example Does BOT_103 clean rooms? (Q5 (POP (BUILDQ (S++++) TYPE SUBJ AUX VP) T) (PUSH PP/ T (SETR VP (APPEND (GETR VP) (LIST @))) (TO Q5))) In Q5, ATN executes (POP (BUILDQ (S++++) TYPE SUBJ AUX VP))  (BUILDQ (S++++) TYPE SUBJ AUX VP) is executed as follows: st plus is replaced with the value of TYPE  The 1 nd plus is replaced with the value of SUBJ  The 2 rd plus is replaced with the value of AUX  The 3 th plus is replaced with the value of VP  The 4  BUILDQ returns (S Q (NP BOT_103) (VP (V clean)) (NP rooms)))  Q5 is final, stack is empty, input is accepted 
  36. 36. References & Reading Suggestions Woods, W. A. (1970). Transition Network Grammars for Natural Language Analysis. Communications of ACM, Vol. 13, Number 10, Oct. 1970, pp. 591-606. 

×