Upload
patience-stanley
View
212
Download
0
Embed Size (px)
Citation preview
1 CSE573 Autumn 1997
02/23/98 Natural Language Processing
• Administrative– PS3 due today
– PS4 out Wednesday, due Friday 3/13 (last day of class)
• special end-of-quarter offer: turn in at the final costs 2 late days!
• Last time– the Graphplan algorithm
• This time– Graphplan
– Natural language processing
2 CSE573 Autumn 1997
NLP Perspective
• An interesting cognitive problem – language is the most “human” communication modality, so it seems
impossible to understand human intelligence without understanding how language works
– Turing test looked on ability to communicate in an unrestricted natural language dialogue as the definition of intelligence
• An interesting practical problem: incredible extensions to usefulness of computers if problems could be solved in – speech recognition and understanding (no more phone menus!)
– handwriting recognition and understanding (a PDA that actually works)
– machine translation (electronic funds transfers and more complex multi-national transactions)
– text recognition (intelligent information retrieval)
3 CSE573 Autumn 1997
The main problem
• The problem is not so well defined: take {spoken/written/textual} language as input, and ...
• Understanding language is “AI Complete”– in order to do it you have to understand every other facet of intelligence as
well --- planning, reasoning about physical systems, geometrical and spatial reasoning, diagnosis, etc. etc.
• The history of natural language processing in AI is a process of discovering just how difficult and deep the problem is
• Ways to make the problem easier– work in limited domains (newspaper stories about earthquakes)
– work with simpler syntax (will respond to information requests or to simple commands but cannot understand arbitrary sentences about the domain). Example: electronic funds transfers; intelligent database front-ends; Truckworld scenarios
4 CSE573 Autumn 1997
The usual breakdown of language processing tasks
• Signal understanding: translate signals (spoken speech or written characters) into some internal symbolic form. Produce phonemes or characters.
• Phonology: group phonemes into morphemes
• Morphology: group morphemes into words
• Syntax: parse words into phrases, phrases into sentences
• Semantics: connect words to objects and concepts in some internal representation language
• Pragmatics: infer what is desired from what is said in a sentence
• Discourse: constructing an argument, negotiating an agreement, (communication among agents)
We are here
Bottom up processing
Top down processing
5 CSE573 Autumn 1997
Our Main Task: A Command Processor
• The system will parse, interpret and execute commands in a simple world– Blocks world (in class):
• “Pick up the green sphere on top of the yellow cube”
• “Put it down next to the red cube.”
– Truckworld (for the problem set): • “Recycle the red broken glass.”
• “Refuel using the fuel drum at position 7.”
• Parsing: is the sentence well formed?
• Semantic Interpretation: – does the command make sense given the current state of the world?
– what do the pronouns refer to?
• Execution: simple call to an execution system (Macrops)
6 CSE573 Autumn 1997
Our Limited Problem
1 2 3 4 5
• Arm can lift at most one object at a time• Pyramid can be put on top of another block but not below• Sphere cannot be put on top or below any block
Actions• pick up top block at current position• put down block being held • move the gripper to another position
7 CSE573 Autumn 1997
Goal of the exercise
• Parse commands, flagging those that are grammatically incorrect
• Verify that the command is legal– does a pickup sentence refer to a single object
– is the gripper at the same location as that object
– is the object at the top of the stack
– is the gripper empty
• If so, “execute it”
8 CSE573 Autumn 1997
Sample Sentences: Grammatical and Feasible
• Pick up the blue pyramid.• Pick up a green block.• Pick up a cube.• Lift the block at position 5.• Move to position 3.• Move to a cube.• Put it down.• Drop the red cube.• Put down a block.
(Feasible under the propercircumstances)
9 CSE573 Autumn 1997
Sample Sentences: Ungrammatical
• Break the pyramid.• Lift a blocks.• Pick up block.• Pick up the green blue pyramid cube.• Move.
10 CSE573 Autumn 1997
Sample Sentences: Grammatical but Infeasible
• Pick up the cubes.
• Move to position 8.
• Pick up the cube; Move to 3; Pick up the green sphere
• Pick up the green sphere; Move to 2; Put it down.
• Pick up a cube; Move to the pyramid; Put down the cube.
• Pick up the cube.
• Pick up a red sphere.
11 CSE573 Autumn 1997
Morphology (the Lexicon)
• The Lexicon (dictionary) is a list of all recognizable words
• Naive approach, just list them
• Redundancy problem– inconsequentially is probably best stored as a variant of the root word
consequent, along with a note that it was negated, and the fact that it is an adverb
• Additional information required– part of speech (rock is both a noun and a verb)– singular or plural (nouns)– tense (verb)– can the verb take an object? (hit versus cried)
• Some typical lexicon entries– (glasses (n (agr p) (root glass))– (detonate (v (tense present) (object t)))– (explode (v (tense present) (object t) (root detonate)))
12 CSE573 Autumn 1997
Lexicon for the Example
13 CSE573 Autumn 1997
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 NounNP Det ADJS Noun
ADJS ADJS Adj ADJS
VP VerbVP Adverb Verb
Det aDet anDet the
Noun rockNoun glassNoun glassesNoun Fred
AdjheavyAdjbrokenAdjred
Actually these are lexicon entrieslike on the previous slide
VerbbreaksVerbrecyclesVerb“Picks up”
AdvquicklyAdvcarefully
14 CSE573 Autumn 1997
Top-down and bottom-up rewrites
S NP VP NP
NP ADJS NounNP Det ADJS Noun
ADJS ADJS Adj ADJS
VP VerbVP Adv Verb
S NP VP NP ADJS Noun VP NP Noun VP NPFred VP NPFred Adverb Verb NPFred carefully Verb NPFred carefully recycles NPFred carefully recycles Det ADJS Noun Fred carefully recycles the ADJS NounFred carefully recycles the Adj ADJS NounFred carefully recycles the heavy ADJS NounFred carefully recycles the heavy Adj ADJS NounFred carefully recycles the heavy red ADJS NounFred carefully recycles the heavy red NounFred carefully recycles the heavy red rock
Fred carefully recycles the heavy red rockNoun Adv Verb Det Adj Adj NounADJS Noun Adv Verb Det Adj Adj NounNP Adv Verb Det Adj Adj NounNP VP Det Adj Adj ADJS NounNP VP Det Adj ADJS NounNP VP Det ADJS NounNP VP NPS
To parse: Fred carefully recycles the heavy red rock
15 CSE573 Autumn 1997
The Parse Tree
Fred carefully recycles the heavy red rock.
S
NP VP NP
NounADJS Adverb Verb Det ADJS Noun
ADJSAdj
ADJSAdj
Fred carefully recyclesthe
heavy
red
rock
16 CSE573 Autumn 1997
Grammar for the Example (first cut)