1 / 9

02/27/98 Natural Language Processing

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

valin
Télécharger la présentation

02/27/98 Natural Language Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. The Lexicon from Last Time (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))) ;; 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))) ))

  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: Actually these are lexicon entries like on the previous slide 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 Verbbreaks Verbrecycles Verb“Picks up” Advquickly Advcarefully

  4. Top-down and bottom-up rewrites S NP VP NP ADJS Noun VP NP Noun VP NP Fred VP NP Fred Adverb Verb NP Fred carefully Verb NP Fred carefullyrecyclesNP Fred carefullyrecyclesDet ADJS Noun Fred carefullyrecyclesthe ADJS Noun Fred carefullyrecyclesthe Adj ADJS Noun Fred carefullyrecyclestheheavy ADJS Noun Fred carefullyrecyclestheheavy Adj ADJS Noun Fred carefullyrecyclestheheavyred ADJS Noun Fred carefullyrecyclestheheavyred Noun Fred carefullyrecyclestheheavyredrock Fred carefullyrecyclestheheavyredrock 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 S NP VP NP NP  ADJS Noun NP  Det ADJS Noun ADJS  ADJS  Adj ADJS VP  Verb VP  Adv Verb To parse: Fred carefullyrecyclestheheavyredrock

  5. The Parse Tree • Fred carefully recycles the heavy red rock. S NP VP NP ADJS Noun Adverb Verb Det ADJS Noun the Fred carefully recycles rock Adj ADJS heavy Adj ADJS red

  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. 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. 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. Grammar for the Example (first cut)

More Related