CS325 Artificial Intelligence Natural Language Processing II (Ch. - - PowerPoint PPT Presentation

cs325 artificial intelligence natural language processing
SMART_READER_LITE
LIVE PREVIEW

CS325 Artificial Intelligence Natural Language Processing II (Ch. - - PowerPoint PPT Presentation

CS325 Artificial Intelligence Natural Language Processing II (Ch. 23) Dr. Cengiz Gnay, Emory Univ. Gnay () Natural Language Processing II (Ch. 23) Spring 2013 1 / 18 So Probabilities Enough for Understanding Language? He came from out of


slide-1
SLIDE 1

CS325 Artificial Intelligence Natural Language Processing II (Ch. 23)

  • Dr. Cengiz Günay, Emory Univ.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 1 / 18

slide-2
SLIDE 2

So Probabilities Enough for Understanding Language?

He came from out of nowhere.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 2 / 18

slide-3
SLIDE 3

So Probabilities Enough for Understanding Language?

He came from out of nowhere. From out of nowhere, he came.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 2 / 18

slide-4
SLIDE 4

So Probabilities Enough for Understanding Language?

He came from out of nowhere. From out of nowhere, he came. Same meaning but different ordering: non-Markovian. How do we understand that both sentences have similar meaning?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 2 / 18

slide-5
SLIDE 5

So Probabilities Enough for Understanding Language?

He came from out of nowhere. From out of nowhere, he came. Same meaning but different ordering: non-Markovian. How do we understand that both sentences have similar meaning? Look at sentence structure: “from out of nowhere” and “he came”

Günay () Natural Language Processing II (Ch. 23) Spring 2013 2 / 18

slide-6
SLIDE 6

So Probabilities Enough for Understanding Language?

He came from out of nowhere. From out of nowhere, he came. Same meaning but different ordering: non-Markovian. How do we understand that both sentences have similar meaning? Look at sentence structure: “from out of nowhere” and “he came” Today:

1 Using sentence structure in NLP 2 Machine translation 3 Speech recognition (no time, see textbook) Günay () Natural Language Processing II (Ch. 23) Spring 2013 2 / 18

slide-7
SLIDE 7

Entry/Exit Surveys

Exit survey: Natural Language Processing I

What is a good method for identifying foreign languages? How do we improve bag of words to learn word sequences?

Entry survey: Natural Language Processing II (0.25 pts)

Give some examples of why learning sentence structure may be useful. What was the most useful machine translation tool you ever used?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 3 / 18

slide-8
SLIDE 8

Uses of Sentence Structure in NLP

Can be useful for: Disambiguation of phrases

Günay () Natural Language Processing II (Ch. 23) Spring 2013 4 / 18

slide-9
SLIDE 9

Uses of Sentence Structure in NLP

Can be useful for: Disambiguation of phrases Understanding meaning

Günay () Natural Language Processing II (Ch. 23) Spring 2013 4 / 18

slide-10
SLIDE 10

Uses of Sentence Structure in NLP

Can be useful for: Disambiguation of phrases Understanding meaning Translation

Günay () Natural Language Processing II (Ch. 23) Spring 2013 4 / 18

slide-11
SLIDE 11

Disambiguation

Strike a match.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 5 / 18

slide-12
SLIDE 12

Disambiguation

Strike a match.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 5 / 18

slide-13
SLIDE 13

Disambiguation

Strike a match.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 5 / 18

slide-14
SLIDE 14

How Can We Use the Sentence Structure?

Hint:

Günay () Natural Language Processing II (Ch. 23) Spring 2013 6 / 18

slide-15
SLIDE 15

How Can We Use the Sentence Structure?

Strike a match Hint:

Günay () Natural Language Processing II (Ch. 23) Spring 2013 6 / 18

slide-16
SLIDE 16

How Can We Use the Sentence Structure?

Strike a match Hint: Verb Noun Noun Noun Phrase Verb Phrase

Günay () Natural Language Processing II (Ch. 23) Spring 2013 6 / 18

slide-17
SLIDE 17

How Can We Use the Sentence Structure?

Strike a match Hint: Verb Noun Noun Noun Phrase Verb Phrase Noun Noun Noun Noun Phrase

Günay () Natural Language Processing II (Ch. 23) Spring 2013 6 / 18

slide-18
SLIDE 18

Where Do the Trees Come From?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 7 / 18

slide-19
SLIDE 19

Where Do the Trees Come From?

From the forest?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 7 / 18

slide-20
SLIDE 20

Where Do the Trees Come From?

From the forest? Seriously, from:

The grammar:

S → VP|NP VP → V NP|V NP → N|N N|N N N N → strike|match V → strike|match

Günay () Natural Language Processing II (Ch. 23) Spring 2013 7 / 18

slide-21
SLIDE 21

Where Do the Trees Come From?

From the forest? Seriously, from:

The grammar:

S → VP|NP VP → V NP|V NP → N|N N|N N N N → strike|match V → strike|match Results in multiple possible parses of the same sentence.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 7 / 18

slide-22
SLIDE 22

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-23
SLIDE 23

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-24
SLIDE 24

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb

Problems?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-25
SLIDE 25

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb

Problems?

1 Omitting a good parsley (false negative): #1 above Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-26
SLIDE 26

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb

Problems?

1 Omitting a good parsley (false negative): #1 above 2 Including a bad parsley (false positive): #2 or #3 above Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-27
SLIDE 27

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb

Problems?

1 Omitting a good parsley (false negative): #1 above 2 Including a bad parsley (false positive): #2 or #3 above

Solutions?

1 Use probabilities 2 Use word associations 3 Unambiguous grammar Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-28
SLIDE 28

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb

Problems?

1 Omitting a good parsley (false negative): #1 above 2 Including a bad parsley (false positive): #2 or #3 above

Solutions?

1 Use probabilities 2 Use word associations 3 Unambiguous grammar Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-29
SLIDE 29

Multiple Possible Parsleys

Parses, parsings, or parsleys (whatever)

“strike a match” can be parsed as:

1 verb noun noun 2 noun noun noun 3 noun noun verb

Problems?

1 Omitting a good parsley (false negative): #1 above 2 Including a bad parsley (false positive): #2 or #3 above

Solutions?

1 Use probabilities 2 Use word associations 3 Unambiguous grammar Günay () Natural Language Processing II (Ch. 23) Spring 2013 8 / 18

slide-30
SLIDE 30

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-31
SLIDE 31

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages. “strike a match”

The probabilistic grammar:

S → VP(0.7)|NP(0.3)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-32
SLIDE 32

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages. “strike a match”

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-33
SLIDE 33

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages. “strike a match”

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-34
SLIDE 34

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages. “strike a match”

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-35
SLIDE 35

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages. “strike a match”

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7) V → strike(0.6)|match(0.3)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-36
SLIDE 36

Use Probabilities and Grammar Together

context-free grammar: Words are expanded without context (e.g., S → VP|NP). Used with programming languages. “strike a match”

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7) V → strike(0.6)|match(0.3) It’s called a probabilistic context-free grammar (PCFG)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 9 / 18

slide-37
SLIDE 37

PCFG Example

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7) V → strike(0.6)|match(0.3) Strike a match Verb Noun Noun Noun Phrase P(Verb Phrase) 0.6 1 0.7 0.3 0.6 Noun Noun Noun P(Noun Phrase)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 10 / 18

slide-38
SLIDE 38

PCFG Example

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7) V → strike(0.6)|match(0.3) Strike a match Verb Noun Noun Noun Phrase P(Verb Phrase)=0.0756 0.6 1 0.7 0.3 0.6 Noun Noun Noun P(Noun Phrase)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 10 / 18

slide-39
SLIDE 39

PCFG Example

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7) V → strike(0.6)|match(0.3) Strike a match Verb Noun Noun Noun Phrase P(Verb Phrase)=0.0756 0.6 1 0.7 0.3 0.6 Noun Noun Noun P(Noun Phrase) 0.4 1 0.7 0.1 0.3

Günay () Natural Language Processing II (Ch. 23) Spring 2013 10 / 18

slide-40
SLIDE 40

PCFG Example

The probabilistic grammar:

S → VP(0.7)|NP(0.3) VP → V NP(0.6)|V(0.4) NP → N(0.6)|N N(0.3)|N N N(0.1) N → strike(0.4)|match(0.7) V → strike(0.6)|match(0.3) Strike a match Verb Noun Noun Noun Phrase P(Verb Phrase)=0.0756 0.6 1 0.7 0.3 0.6 Noun Noun Noun P(Noun Phrase)=0.0084 0.4 1 0.7 0.1 0.3

Günay () Natural Language Processing II (Ch. 23) Spring 2013 10 / 18

slide-41
SLIDE 41

How to Get Grammar Probabilities?

I made them up :) Can we count them?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-42
SLIDE 42

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-43
SLIDE 43

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems:

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-44
SLIDE 44

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-45
SLIDE 45

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-46
SLIDE 46

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-47
SLIDE 47

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions Solution?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-48
SLIDE 48

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions Solution? Machine learning

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-49
SLIDE 49

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions Solution? Machine learning But where’s the data?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-50
SLIDE 50

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions Solution? Machine learning But where’s the data? Need to pay people to build databases (e.g., Penn Tree Bank)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-51
SLIDE 51

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions Solution? Machine learning But where’s the data? Need to pay people to build databases (e.g., Penn Tree Bank) Can you think of a better solution?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-52
SLIDE 52

How to Get Grammar Probabilities?

I made them up :) Can we count them? No, they are ambiguous out in the wild. First need a model of grammar, but problems: Grammars are biologically evolved They are complex and rough Neat rules all have exceptions Solution? Machine learning But where’s the data? Need to pay people to build databases (e.g., Penn Tree Bank) Can you think of a better solution? Understand context first?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 11 / 18

slide-53
SLIDE 53

Example Grammar

Günay () Natural Language Processing II (Ch. 23) Spring 2013 12 / 18

slide-54
SLIDE 54

Back to Disambiguation with Learned Grammar

Günay () Natural Language Processing II (Ch. 23) Spring 2013 13 / 18

slide-55
SLIDE 55

Back to Disambiguation with Learned Grammar

Lexicalized grammar: Probabilities of where words belong (can get help

Günay () Natural Language Processing II (Ch. 23) Spring 2013 13 / 18

slide-56
SLIDE 56

Lexicalized PCFG (LPCFG)

OMG! That’s a long acronym.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 14 / 18

slide-57
SLIDE 57

Lexicalized PCFG (LPCFG)

OMG! That’s a long acronym. Probabilities based on actual words: P(VP → V NP NP|V = gave) = 0.8 (common : gave me something) P(VP → V NP NP|V = kiss) = 0.1 (rare : kiss me goodbte)

Günay () Natural Language Processing II (Ch. 23) Spring 2013 14 / 18

slide-58
SLIDE 58

Lexicalized PCFG (LPCFG)

OMG! That’s a long acronym. Probabilities based on actual words: P(VP → V NP NP|V = gave) = 0.8 (common : gave me something) P(VP → V NP NP|V = kiss) = 0.1 (rare : kiss me goodbte) But telescope example still hard to solve. But we can use: Smoothing Abstractions

Günay () Natural Language Processing II (Ch. 23) Spring 2013 14 / 18

slide-59
SLIDE 59

Putting Them Together: Parsing Trees with LPCFGs

So we have all the information now. How to parse language into trees?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 15 / 18

slide-60
SLIDE 60

Putting Them Together: Parsing Trees with LPCFGs

So we have all the information now. How to parse language into trees? Two options:

1 Start from words (bottom up); like starting from initial state Günay () Natural Language Processing II (Ch. 23) Spring 2013 15 / 18

slide-61
SLIDE 61

Putting Them Together: Parsing Trees with LPCFGs

So we have all the information now. How to parse language into trees? Two options:

1 Start from words (bottom up); like starting from initial state 2 Start from sentence (top down); like starting from goal state Günay () Natural Language Processing II (Ch. 23) Spring 2013 15 / 18

slide-62
SLIDE 62

Putting Them Together: Parsing Trees with LPCFGs

So we have all the information now. How to parse language into trees? Two options:

1 Start from words (bottom up); like starting from initial state 2 Start from sentence (top down); like starting from goal state

So it becomes like a regular tree search!

Günay () Natural Language Processing II (Ch. 23) Spring 2013 15 / 18

slide-63
SLIDE 63

Putting Them Together: Parsing Trees with LPCFGs

So we have all the information now. How to parse language into trees? Two options:

1 Start from words (bottom up); like starting from initial state 2 Start from sentence (top down); like starting from goal state

So it becomes like a regular tree search! Note: Context-free grammars have advantage of parsing parts of the tree independent of the rest. That is, we can divide and conquer.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 15 / 18

slide-64
SLIDE 64

Machine Translation

Günay () Natural Language Processing II (Ch. 23) Spring 2013 16 / 18

slide-65
SLIDE 65

Machine Translation

Günay () Natural Language Processing II (Ch. 23) Spring 2013 16 / 18

slide-66
SLIDE 66

Machine Translation

Günay () Natural Language Processing II (Ch. 23) Spring 2013 16 / 18

slide-67
SLIDE 67

Machine Translation Levels

Multi-level pyramid of machine translation (by Vauquois):

1 Word by word 2 Phrase 3 Tree 4 Meaning (semantic) Günay () Natural Language Processing II (Ch. 23) Spring 2013 17 / 18

slide-68
SLIDE 68

Machine Translation Levels

Multi-level pyramid of machine translation (by Vauquois):

1 Word by word 2 Phrase 3 Tree 4 Meaning (semantic)

We’ll concentrate on #2, but others are used on the field, too.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 17 / 18

slide-69
SLIDE 69

Phrase Translation

Günay () Natural Language Processing II (Ch. 23) Spring 2013 18 / 18

slide-70
SLIDE 70

Phrase Translation

What else to improve?

Günay () Natural Language Processing II (Ch. 23) Spring 2013 18 / 18

slide-71
SLIDE 71

Phrase Translation

What else to improve? Calculate p(e) from LPCFG and check if translated sentence is likely.

Günay () Natural Language Processing II (Ch. 23) Spring 2013 18 / 18