1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

12
1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems

Transcript of 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

Page 1: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

1

CS 385 Fall 2006Chapter 14

Understanding Natural Language

Problems

Page 2: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

2

Problem 3/4

1. sentence np vp

2. np n

3. np art n

4. vp v

5. vp v np

6. art a

7. art the

8. n man

9. n dog

10. v likes

11. v bites

The big dog bites the man

(no adjectives)

12. np adj n

13. np art adj n

14. adj big

Emma likes the boy

(add Emma, boy)

The man likes

Bite the man

15. sentence vp

16. v bite

Page 3: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

3

Parsing bite the man

Top down: start at sentence symbol and work down to a string of terminals

1. sentence np vp

2. np n

3. np art n

4. vp v

5. vp v np

6. art a

7. art the

8. n man

9. n dog

10. v likes

11. v bites

15. sentence vp

16. v bite

sentence

→ vp

→ v np

→ bite np

→ bite art n

→ bite the n

→ bite the man

Page 4: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

4

Problem 5Grammar:

1. sentence ↔ noun_phrase verb_phrase

2. noun_phrase ↔ article number noun

3. article singular ↔ a singular

4. article singular ↔ the singular

5. article plural ↔ the plural

6. singular noun ↔ man singular

7. singular noun ↔ dog singular

8. plural noun ↔ men plural

9. singular verb phrase ↔ singular verb

10. singular verb ↔ bites

11. plural verb phrase ↔ plural verb

12. plural verb ↔ like

13. verb_phrase ↔ verb noun_phrase (missing)

Parse: The men like the dog:

sentence

noun_phrase verb_phrase

article plural noun verb_phrase

The plural noun verb_phrase

The men plural verb_phrase

The men plural verb_phrase

The men plural verb noun_phrase

The men like noun_phrase

...

Page 5: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

5

Problem 7

noun_phrase <-> adjective_list noun

noun_phrase <-> article adjective_list noun

adjective-list <-> adjective

adjective_list <-> adjective adjective_list

Sinitialart n

Sfinal

n

artn

adj_list

nadj_list

noun_phrase

adjective_list

Sinitialadjective adjective_list

Sfinal

adjective

Page 6: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

6

Problem 9

New Noun_phrase definition:

Add dictionary entries for specific adjectives

E.g. brown:PART_OF_SPEECH: adjective

ROOT: brown

NUMBER: p or s

Adjective_list

Adjective:

Remaining-list: *

*(null or pointer to an adjective_list)

Noun_phrase

Determiner:

Adjective_list:

Noun:

Number

Page 7: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

7

Problem 9

Add arcs and procedures to ATN diagram:

procedure noun_phrase4 begin ADJECTIVE_LIST := structure returned by ADJECTIVE_LIST network if ADJECTIVE_LIST.ADJECTIVE = null fail end;

procedure noun_phrase5 begin NOUN:= structure returned by NOUN network if NOUN_PHRASE.NOUN.PART_OF_SPEECH= noun begin NOUN_PHRASE.NOUN = NOUN NOUN_PHRASE.ADJECTIVE_LIST = ADJECTIVE_LIST NOUN_PHRASE.NUMBER = NOUN.NUMBER end else fail end;

Sinitialart n

Sfinal

n

art

n

adj_lis t

n

adj_lis t

noun_phrase

7

45

86

Page 8: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

8

Problem 9

Add arcs and procedures to ATN diagram:

procedure noun_phrase6 begin ARTICLE:= structure returned by ARTICLE network if ARTICLE.PART_OF_SPEECH <> article fail endprocedure noun_phrase7 begin (same as noun_phrase4) end procedure noun_phrase8

begin NOUN:= structure returned by NOUN network if NOUN_PHRASE.NOUN.PART_OF_SPEECH = noun begin NOUN_PHRASE.ARTICLE= ARTICLE NOUN_PHRASE.NOUN = NOUN NOUN_PHRASE.ADJECTIVE_LIST = ADJECTIVE_LIST NOUN_PHRASE.NUMBER = NOUN.NUMBER end else fail end

Sinitialart n

Sfinal

n

art

n

adj_lis t

n

adj_lis t

noun_phrase

7

45

86

Page 9: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

9

Problem 10

What is added because of adjectives?– Do they add anything to the type hierarchy?

– Are there case frames (fig 14.11) for any of the adjectives?

– Does this add to the semantic rep for a sentence?

E.g. "Bob has brown hair" uses frame for "has"

to build

brown colorisa

animate has entityagent object

person: Bob has hairagent object brown colorisahasprop

Page 10: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

10

Procedures:procedure noun_phrase

begin

call adjective_phrase to get a representation for the adjective_phrase

call noun to get a representation of the noun

case

the article is indefinite and the number singular: the noun concept is generic

the article is definite and number singular: bind marker to noun concept

number is plural: indicate that the noun concept is plural

bind case frames for each adjective to the noun

end

procedure adjective

begin

retrieve the concept for the adjective

end

procedure adjective_phrase

begin

(get the linked list of adjectives)

end

brown colorisa

Page 11: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

11

Bob has brown hair:

1. call sentence

2. sentence calls noun_phrase

3. noun_phrase calls noun

4. noun returns frame for Bob

Do we know Bob is a person?

If so, bind Bob to person

5. verb_phrase calls verb which retrieves

case frame for has

6. verb_phrase calls noun_phrase

7. noun_phrase calls adjective_phrase to

retrieve brown which returns case frame for brown

8. noun_phrase calls noun which returns hair

Attach to case frame for brown

9. Combine case frame for has to the subject

(Bob) and object (brown hair)

person: Bob

animate has entityagent object

brown colorisa

hair brown colorisahasprop

person: Bob has hairagent object brown colorisahasprop

PART_OF_SPEECH: adjective

ROOT: brown

NUMBER: s

PART_OF_SPEECH: noun

ROOT: hair

NUMBER: s

PART_OF_SPEECH: noun

ROOT: Bob

NUMBER:s

PART_OF_SPEECH: verb

ROOT: has

NUMBER:s

Page 12: 1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language Problems.

12

Problem 19

Possible domains:– shopping (how does bizrate.com or shopzilla work?)

– ??

Is there an underlying template?

You: – pick a domain

– construct a hypothetical template

– speculate on how it works

Also callled web mining, information extraction– many interesting products to crawl with your specific agenda

– how are they built?