02 27 98 natural language processing n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
02/27/98 Natural Language Processing PowerPoint Presentation
Download Presentation
02/27/98 Natural Language Processing

Loading in 2 Seconds...

play fullscreen
1 / 9

02/27/98 Natural Language Processing - PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about '02/27/98 Natural Language Processing' - valin


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
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
  • This time
    • parsing (building the grammar)
the lexicon from last time
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)))

))

parsing
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

top down and bottom up rewrites
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

the parse tree
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

using the supplied parser
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)))))

parser code continued the grammar
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))

))

parser code continued io
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))))))