CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

37
CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING August 2010 Instructors: Liang Huang and Kevin Knight TA: Jason Riesa

Transcript of CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

Page 1: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

August 2010

Instructors: Liang Huang and Kevin Knight

TA: Jason Riesa

Page 2: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Doesn’t Google know everything?What animal does a cat eat?

2

Page 3: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Even Key Word Queries

• Paris Hilton -- not easy to book! (vs. Boston Hilton)

3

Page 4: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguity

Where can I spot a snow leopard?

4

Page 5: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

• to middle school kids: what does this sentence mean?

5

Aravind Joshi

I saw her duck.

Page 6: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

• to middle school kids: what does this sentence mean?

5

Aravind Joshi

I saw her duck.

Page 7: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

• to middle school kids: what does this sentence mean?

5

Aravind Joshi

I saw her duck.

lexical ambiguity(word-sense)

Page 8: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

6

Aravind Joshi

I eat sushi with tuna.

• to middle school kids: what does this sentence mean?

Page 9: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

6

Aravind Joshi

I eat sushi with tuna.

• to middle school kids: what does this sentence mean?

structural ambiguity(PP-attachment)

Page 10: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

7

Aravind Joshi

I eat sushi with tuna.

• to middle school kids: what does this sentence mean?

Page 11: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

7

Aravind Joshi

I eat sushi with tuna.

• to middle school kids: what does this sentence mean?

lexical ambiguity(word-sense)

Page 12: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

8

Aravind Joshi

Everybody loves somebody.

• to middle school kids: what does this sentence mean?

???

Page 13: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

8

Aravind Joshi

Everybody loves somebody.

• to middle school kids: what does this sentence mean?

structural ambiguity(quantifier scope)

???

Page 14: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

9

Aravind Joshi

• to middle school kids: what does this sentence mean?

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo

Page 15: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

9

Aravind Joshi

• to middle school kids: what does this sentence mean?

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo

http://www.cse.buffalo.edu/~rapaport/BuffaloBuffalo/buffalobuffalo.html

Page 16: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

9

Aravind Joshi

• to middle school kids: what does this sentence mean?

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo

http://www.cse.buffalo.edu/~rapaport/BuffaloBuffalo/buffalobuffalo.html

Page 17: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

More about Ambiguities

9

Aravind Joshi

• to middle school kids: what does this sentence mean?

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo

Dogs dogs dog dog dogs.Police police police police police

http://www.cse.buffalo.edu/~rapaport/BuffaloBuffalo/buffalobuffalo.html

Page 18: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguities in Translation

10

zi zhu zhong duan自 助 终 端

self help terminal device

Page 19: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguities in Translation

11

Page 20: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguities in Translation

11

Page 21: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguities in Translation

11

Page 22: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguities in Translation

11

Page 23: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

If you are stolen...

12

Page 24: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

or even...

13

Page 25: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

or even...

13clear evidence that NLP is used in real life!

Page 26: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Grammar

SBARQ

WHNP SINV

VBZ NPWhat animal

does a cat

VP

VB NP

eat t

14

Page 27: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

DP for incremental parsing

PP Attachment Ambiguity

15

Page 28: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

DP for incremental parsing

PP Attachment Ambiguity

15

One morning in Africa, I shot an elephant in my pajamas;

Page 29: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

DP for incremental parsing

PP Attachment Ambiguity

15

One morning in Africa, I shot an elephant in my pajamas;

how he got into my pajamas I’ll never know.

Page 30: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

DP for incremental parsing

PP Attachment Ambiguity

15

One morning in Africa, I shot an elephant in my pajamas;

how he got into my pajamas I’ll never know.

Page 31: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguity Explosion

16

I saw her duck.

Page 32: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguity Explosion

• how about...

• I saw her duck with a telescope.

• I saw her duck with a telescope in the garden...16

...

I saw her duck.

Page 33: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Ambiguity Explosion

• exponential explosion of the search space

• Q1: how to represent ambiguities (compactly)?

• Q2: how to search over this space (efficiently)?

• Q3: how to rank different hypotheses?

17

..

S

NP

PRP

I

VP

VBD

saw

NP

PRP$

her

NN

duck

PP

IN

with

NP

DT

a

NN

telescope

Page 34: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Answers...

• Q1: how to represent ambiguities?

• context-free grammar (unit 2)

• finite-state automata (unit I)

• Q2: how to search in this space?

• dynamic programming (units 1&2)

• Q3: how to rank these hypotheses?

• weighted grammar (units 1-3)

• weights learned from data

• (saw, with, telescope) seen more often in texts18

S

NP

PRP

I

VP

VBD

saw

NP

PRP$

her

NN

duck

PP

IN

with

NP

DT

a

NN

telescope

Page 35: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Why Learning?

• learning is better than hand-written rules, because:

• less work; easily adapts to new languages/domains

• Powerset (now bing.com): 15 years for English grammar!

• now they are writing their Chinese grammar...

• and languages constantly change!

• learning can work, and often works better!

• machine translation: used to be dominated by rule-based

• now statistical methods are better: google vs. systran

• google learns from the web, and translates 40+ langs

19[also CS 567, Machine Learning, Fall 2010]

Page 36: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Example - Rosetta Stone

• the most famous (tri-)parallel text

• machines can do the same job! (if given parallel text)

• UN/EU/Ca proceedings, News, tech manuals, ...20

Page 37: CS 562: STATISTICAL NATURAL LANGUAGE PROCESSING

CS 562 - Intro

Take Home Message

• languages are beyond just bags of words!

• ambiguity is everywhere, and NLP is all about that

• we’ll teach machines how to read and translate...

• and how to learn to read and translate from data

• have fun in this class! :)

21