Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE573 Autumn 1997 1 02/27/98 Natural Language Processing Administrative –New version of PS4 on the Web different interface to the Truckworld more extra.

Similar presentations


Presentation on theme: "CSE573 Autumn 1997 1 02/27/98 Natural Language Processing Administrative –New version of PS4 on the Web different interface to the Truckworld more extra."— Presentation transcript:

1 CSE573 Autumn 1997 1 02/27/98 Natural Language Processing Administrative –New version of PS4 on the Web different interface to the Truckworld more extra credit options –PS4 due Friday 3/13 (last day of class) special end-of-quarter offer: turn in at the final costs 2 late days! Last time –building the lexicon This time –parsing (building the grammar)

2 CSE573 Autumn 1997 2 The Lexicon from Last Time ;; Omitted green, blue, purple (red (adj (root red))) (orange (adj (root orange))) (yellow (adj (root yellow))) (block (noun (root block))) (sphere (noun (root sphere))) (cube (noun (root cube))) (pyramid (noun (root pyramid))) (position (noun (root position))) ;; Omitted three through five (one (number (root 1))) (two (number (root 2))) (1 (number (root 1))) (2 (number (root 2))) (the (art (count one) (root the))) (a (art (count any) (root a))) (an (art (count any) (root an))) )) (setf *lexicon* '( (lift (verb (root lift))) (pick-up (verb (root lift))) (drop (verb (root drop))) (put-down (verb (root drop))) (move (verb (root move))) (pick (verb-h (root pick))) (put (verb-h (root put))) (on (prep (root on))) (above (prep (root above))) (below (prep (root below))) (next-to (prep (root next-to))) (at (prep (root at))) (up (prep-h (root up))) (down (prep-h (root down))) (next (prep-h (root next))) (to (prep-h (root to))) (of (prep-h (root of))) (left (dir (root left))) (right (dir (root right)))

3 CSE573 Autumn 1997 3 Parsing The task: –take as input a sentence (list of symbols/words) and a grammar –produce as output whether or not the sentence is grammatical? a parse tree? Grammar as rewrite rules: S  NP VP NP NP  ADJS Noun NP  Det ADJS Noun ADJS  ADJS  Adj ADJS VP  Verb VP  Adverb Verb Det  a Det  an Det  the Noun  rock Noun  glass Noun  glasses Noun  Fred Adj  heavy Adj  broken Adj  red Actually these are lexicon entries like on the previous slide Verb  breaks Verb  recycles Verb  “Picks up” Adv  quickly Adv  carefully

4 CSE573 Autumn 1997 4 Top-down and bottom-up rewrites S  NP VP NP NP  ADJS Noun NP  Det ADJS Noun ADJS  ADJS  Adj ADJS VP  Verb VP  Adv Verb S  NP VP NP  ADJS Noun VP NP  Noun VP NP  Fred VP NP  Fred Adverb Verb NP  Fred carefully Verb NP  Fred carefully recycles NP  Fred carefully recycles Det ADJS Noun  Fred carefully recycles the ADJS Noun  Fred carefully recycles the Adj ADJS Noun  Fred carefully recycles the heavy ADJS Noun  Fred carefully recycles the heavy Adj ADJS Noun  Fred carefully recycles the heavy red ADJS Noun  Fred carefully recycles the heavy red Noun  Fred carefully recycles the heavy red rock Fred carefully recycles the heavy red rock Noun Adv Verb Det Adj Adj Noun ADJS Noun Adv Verb Det Adj Adj Noun NP Adv Verb Det Adj Adj Noun NP VP Det Adj Adj ADJS Noun NP VP Det Adj ADJS Noun NP VP Det ADJS Noun NP VP NP S To parse: Fred carefully recycles the heavy red rock

5 CSE573 Autumn 1997 5 The Parse Tree l Fred carefully recycles the heavy red rock. S NPVPNP NounADJSAdverbVerbDetADJSNoun ADJSAdj ADJSAdj Fredcarefullyrecycles the heavy red rock

6 CSE573 Autumn 1997 6 Using the Supplied Parser (defvar *lexicon*) (setf *lexicon* '( (rock (noun (root rock))) (rocks (noun (root rock))) (glass (noun (root glass))) (glasses (noun (root glass))) (fred (noun (root fred))) (a (det (root a))) (an (det (root an))) (the (det (root the))) (heavy (adj (root heavy))) (broken (adj (root broken))) (red (adj (root red))) (breaks (verb (root break))) (recycles (verb (root recycle))) (lifts (verb (root lift))) (quickly (adv (root quick))) (carefully (adv (root care)))))

7 CSE573 Autumn 1997 7 Parser Code Continued: The Grammar (defvar *grammar*) (setf *grammar* '( ((s) -> (np) (vp) (np)) ((np) -> (det) (opt-adjs) (noun)) ((np) -> (noun)) ((opt-adjs) -> (adj) (opt-adjs)) ((opt-adjs) ->) ((vp) -> (verb)) ((vp) -> (adv) (verb)) ))

8 CSE573 Autumn 1997 8 Parser Code Continued: IO (defun do-parse (sentence &key (start-symbol 's) (verbose T)) (parse :start-symbol start-symbol :sentence sentence :verbose verbose :print verbose)) (do-parse '(fred carefully recycles the heavy red rock)) (S (1 (NP (1 (NOUN (ROOT FRED))))) (2 (VP (1 (ADV (ROOT CARE))) (2 (VERB (ROOT RECYCLE))))) (3 (NP (1 (DET (ROOT THE))) (2 (OPT-ADJS (1 (ADJ (ROOT HEAVY))) (2 (OPT-ADJS (1 (ADJ (ROOT RED))) (2 (OPT-ADJS)))))) (3 (NOUN (ROOT ROCK))))))

9 CSE573 Autumn 1997 9 Grammar for the Example (first cut)


Download ppt "CSE573 Autumn 1997 1 02/27/98 Natural Language Processing Administrative –New version of PS4 on the Web different interface to the Truckworld more extra."

Similar presentations


Ads by Google