Presentation is loading. Please wait.

Presentation is loading. Please wait.

Understanding Natural Language

Similar presentations


Presentation on theme: "Understanding Natural Language"— Presentation transcript:

1 Understanding Natural Language
13 Understanding Natural Language 13.0 Role of Knowledge in Language Understanding 13.1 Deconstructing Language: A Symbolic Analysis 13.2 Syntax 13.3 Syntax and Knowledge with ATN parsers 13.4 Stochastic Tools for Language Analysis 13.5 Natural Language Applications 13.6 Epilogue and References 13.7 Exercises Additional sources used in preparing the slides: Patrick H. Winston’s AI textbook, Addison Wesley, 1993.

2 Chapter Objective Give a brief introduction to the techniques used in understanding natural language

3 An early natural language understanding system: SHRDLU (Winograd, 1972)

4 It could converse about a blocks world
What is sitting on the red block? What shape is the blue block on the table? Place the green cylinder on the red brick. What color is the block on the red block? Shape?

5 Stages of language analysis
1. Parsing: analyze the syntactic structure of a sentence 2. Semantic interpretation: analyze the meaning of a sentence 3. Contextual/world knowledge representation: Analyze the expanded meaning of a sentence For instance, consider the sentence: Tarzan kissed Jane.

6 The result of parsing would be:

7 The result of semantic interpretation

8 The result of contextual/world knowledge interpretation

9 Can also represent questions: Who loves Jane?

10 Parsing using Context-Free Grammars
A bunch of rewrite rules: 1. sentence  noun_phrase verb_phrase 2. noun_phrase  noun 3. noun_phrase  article noun 4. verb_phrase  verb 5. verb_phrase  verb noun_phrase 6. article  a 7. article  the 8. noun  man 9. noun  dog 10. verb  likes 11. verb  bites These are the nonterminals These are the terminals These are the symbols of the grammar

11 Parsing It is the search for a legal derivation of the sentence in hand starting with the nonterminal “sentence”. “Sentence” is the starting nonterminal. The result is a parse tree. A parse tree is a structure where each node is a symbol from the grammar. The root node is the starting nonterminal, the intermediate nodes are nonterminals, the leaf nodes are terminals.

12 The parse tree

13 Transition networks

14 The main idea Represent the rules in the grammar in the form of transition networks Then parsing a sentence is a matter of traversing the network: If the label of the transition (arc) is a terminal, it must match the input, and the input pointer advances If the label of the transition (arc) is a nonterminal, the corresponding transition network is invoked recursively If several alternative paths are possible, each must be tried (backtracking)---very much like nondeterministic finite automaton---until a successful path is found

15 Parsing the sentence “Dog bites.”

16 Notes A “successful parse” is the complete traversal of the net for the starting nonterminal from sinitial to sfinal . If no path works, the parse “fails.” It is not a valid sentence. The following algorithm would be called using parse(sinitial ) It would start with the net for “sentence.”

17 The algorithm Function parse(grammar_symbol);
begin save pointer to current location in input stream; case grammar_symbol is a terminal; if grammar_symbol matches the next word in the input stream then return(success) else begin reset input stream return(failure) end; grammar_symbol is a nonterminal; begin retrieve the transition network labeled by grammar_symbol state := start state of network; if transition(state) returns success then return(success) else begin reset input stream; return (failure) end end end.

18 The algorithm (cont’d)
Function parse(grammar_symbol); begin save pointer to current location in input stream; case grammar_symbol is a terminal; if grammar_symbol matches the next word in the input stream then return(success) else begin reset input stream return(failure) end; grammar_symbol is a nonterminal; begin retrieve the transition network labeled by grammar_symbol state := start state of network; if transition(state) returns success then return(success) else begin reset input stream; return (failure) end end end.

19 The algorithm (cont’d)
Function transition(current_state); begin case current_state is a final state: return (success) current_state is not a final state: while there are unexamined transitions out of current_state do begin grammar_symbol := the label on the next unexamined transition if parse(grammar_symbol) returns (success) then begin next_state := state at the end of the transition; if transition(next_state) returns (success); then return(success) end end return(failure) end end.

20 Grammars might be ambiguous

21 A different parse tree for the same sentence

22 The network may contain “loops”
Noun-phrase: adjective article noun si si si Traverse “adjective” twice to parse the noun phrase: “the cute little puppy”

23 Comments of transition networks
They capture the regularity in the sentence structure They exploit the fact that only a small vocabulary is needed in a specific domain If a sentence “doesn’t make sense”, it might be caught by the domain information. For instance, the answer to both of the following questions is “there is none” “Pick up the blue cylinder” “Pick up the red blue cylinder”


Download ppt "Understanding Natural Language"

Similar presentations


Ads by Google