language understanding and rete match n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Language Understanding and Rete Match PowerPoint Presentation
Download Presentation
Language Understanding and Rete Match

Loading in 2 Seconds...

play fullscreen
1 / 20

Language Understanding and Rete Match - PowerPoint PPT Presentation


  • 101 Views
  • Uploaded on

Language Understanding and Rete Match. Content of this lecture: Demo of Façade Language Understanding in Façade Efficiency of RA cycle The Rete Algorithm. Properties of game: Characters controlled by AI Two computer, one human player Bots talk, human types The story

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Language Understanding and Rete Match' - rebekah


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
language understanding and rete match

Language Understanding and Rete Match

Content of this lecture:

Demo of Façade

Language Understanding in Façade

Efficiency of RA cycle

The Rete Algorithm

fa ade interactive plot development
Properties of game:

Characters controlled by AI

Two computer, one human player

Bots talk, human types

The story

Trip and Grace have wedding anniversary

Relation is not very good

Human visitor influences developments

DEMO:

Video 8 minutes (YouTube 5)

True interactive play

interactivestory.net

Façade: Interactive Plot Development

Michael Mateas, Andrew Stern: Natural Language Understanding in Façade: Surface Text processing, LNCS 3105, pp3-13.

Expert Systems 4

language understanding
Bert gaat naar de supermarkt.

Bert vindt melk in in de koeling.

Bert praat met Jolanda.

Bert geeft Jolanda geld.

Questions about this text:

Why does Bert give the money?

Why is Jolanda there?

How much does Bert give?

Answers require large amount of background knowledge.

Language Understanding

Expert Systems 4

three levels of language processing
Syntax Level: structure

What sentences are well-formed

What is the role of each word in the sentence structure

Challenge:Fruit flies like bananasTime flies like an arrow

Semantic Level: meaning

Assign a precise meaning to each word and construct

Synthesize meaning of sentence (story)

Three levels of Language Processing

Pragmatic Level: goal

  • Map text to desire, opinion, statement, question …
  • Discourse act
  • - Do you have a pen?- Yes.

Expert Systems 4

fa ade maps text to discourse acts
Façade maps text to Discourse Acts

Discourse Acts with one

character attribute:

  • (DAAgree ?char)
  • (DADisagree ?char)
  • (DAThank ?char)
  • (DAFlirt ?char)
  • (DAGoodbye ?char)

More Discourse Acts:

  • (DASysDontUnd)
  • (DAExpress ?ch ?tp)
  • (DACriticize ?ch ?lev)
  • (DAAdvice ?par ?ch)

There exist 24 DA’s

Examples of sentences:

  • (DAFlirt ?ch): “You look gorgeous”, “Kiss me”.
  • (DADisagree ?ch): “Fat chance”, “I don’t think …”.
  • (DACriticize ?ch ?lev): “You’re weird”, “Kiss off”.
  • (DAReferTo ?ch ?obj): “When did you get the couch?”

Expert Systems 4

between text and discourse acts
Between text and Discourse Acts

Intermediates group words into a meaning class

  • iIs fact generalizes am, are, is, seems, sounds
  • iPosDescr generalizes friend, good, big
  • iChar stands for a reference to a character

Intermediates map word combinations to meaning

  • iChar + iIs + iPosDesc  iPraise

Combinations of intermediates form Discourse Acts

  • (iChar ?ch) + iGreet  (DAGreet ?ch)

It will be very easy to fool Façade…

… but natural utterances receive natural response!

Expert Systems 4

storage in fa ade clips jess
Store input sentence in word occurrence facts:

Ex: “Grace, kiss me”

Template per iNtermediate

Storage in Façade: CLIPS/JESS

Template per DA:

Expert Systems 4

recognize a flirt
Recognize a flirt…
  • You are gorgeous
  • I find you more than gorgeous
  • You have gorgeous eyes

(defrule rec-flirt

(wo you ?s1 ?e1)

(wo gorgeous ?s2 ?e2)

(?e1 < ?s2)

=>

(assert (iFlirt ?s1 ?e2))

)

Problems with this?

  • This is not how language HE thinks
  • What if I find you all but gorgious…

Expert Systems 4

the template language
The template language
  • (X Y): matches occurrence of X followed by Y
  • (X | Y): matches sentence with X or with Y
  • *: wildcard
  • (template ( you * (gorgeous | brilliant)))
  • Template conditions are automatically rewritten to true CLIPS conditions on wo and iNtermediate facts
  • Recognized iFacts are stored with position:(template ( you * iPositivePersonDesc))

Higher-order description of conditions facilitates knowledge acquisition from language expert.

Expert Systems 4

not and other idiomatic expressions
Not and other idiomatic expressions
  • Idiomatic rules match word combinations that change each other’s pragmatic meaning:

(template (not iPositivePersonDesc))

=>

(assert iNegativePersDesc)

  • The idiomatic rules remove the recognized terms

(retract iPositivePersonDesc)

(retract not)

  • Gets rid of fruit fly problem…… if combination is recognizedin time!!

Expert Systems 4

organization of fa ade nlu rule base
Organization of Façade NLU Rule Base
  • Patterns and synonymsExample: iIs, iGreet, …
  • Idiomatic expressions (1000 rules!)Example: pisses me off, kiss off (vs. kiss me!!).Use retraction!
  • Negative wordsExample: not bad
  • Combination rules recognize combinations as (sub-) discourse acts
  • These classes are ordered by salience
  • The rule base reflects human (conscious) thinking about language
  • Anaphora resolution: store referent for it, he, she.

Expert Systems 4

efficiency of recognize act cycle

1: Match

2: Choose

3: Apply

Efficiency of Recognize-Act Cycle
  • Actual work: Apply.
  • Interpreter spends >90% of time in Match!
  • Finds all matches to execute one rule:Partial matching
  • Matching processes the same facts over and over again: Redundancy! Within-cycle Between-cycleRete algorithm

Expert Systems 4

partial construction of conflict set
Partial construction of conflict set
  • Combine Match and Choose (into recognize)
  • Search for applicable rules and execute first found
  • Look for instantiations of rules in order of decreasing salience
  • For Recency: Match facts in order of decreasing time stamps.
  • For Breadth: order of increasing time stamps.

Improvement may be significant

Practical programs still run impractically ssslllooowww…

Need: RETE Algorithm (Forgy, 1982)

Expert Systems 4

flirting by database

wo

word=you

word=gorgeous

T1

T2

le.ep < ri.sp

Conflict set

for rec-flirt

Flirting by Database
  • Recognize as iFlirt:(template (you * gorgeous))
  • (wo (word you) (sp ?s1) (ep ?e1))(wo (word gorgeous) (sp ?s2) (ep ?e2))(?e1 < ?s2)
  • Describe as select and conditional join operations:T1 = SEL (word = you) [wo]T2 = SEL (word = gorgeous) [wo]CS = CJOIN (le.ep < ri.sp)[T1,T2]
  • Recognize as negation:(template (not gorgeous))

Expert Systems 4

eliminate within cycle redundancy

wo

word=you

word=gorgeous

word=not

T1

T2

T3

T2

le.sp = ri.ep+1

le.ep < ri.sp

Conflict set

for rec-flirt

Conflict set

for rec-neg

Eliminate within-cycle redundancy
  • Build data flow network
  • Combine common paths
  • Each operation is executed only once
  • Less within-cycle redundancy
  • Some redundancy remains
  • Compute only once from program

Expert Systems 4

eliminate between cycle redundancy

wo

word=you

word=gorgeous

word=not

T1

T2

T3

T2

le.sp = ri.ep+1

le.ep < ri.sp

Conflict set

for rec-flirt

Conflict set

for rec-neg

Eliminate between-cycle redundancy
  • Retain tables of partial matches
  • Addition of fact:Propagate token through Rete graph
  • Removal of fact:Propagate negative token through graph

Expert Systems 4

rete in clips pattern network

wo

word = you

sp > 3

len = 4

Alpha C1

Alpha C2

Rete in CLIPS: Pattern Network
  • For each condition, CLIPS builds a pattern network
  • Condition 1:(wo (word you) (sp ?s1&>3) (ep ?e1&<?s2))
  • Condition 2:(wo (word you) (sp ?s1&>3) (len 4) )
  • Share patterns for conditions if first parts are the same

Expert Systems 4

rete in clips join network

Beta 0

Beta 1

Beta 2

Alpha C1

Alpha C2

Alpha C3

J1

J2

J3

Alpha C4

J4

ConfSet 2

Rete in CLIPS: Join Network
  • For each rule, CLIPS builds a JOIN network
  • One JOIN per condition
  • Rule 1:(defrule donop (C1) (C2) (C3) => )
  • Rule 2:(defrule nopdo (C1) (C2) (C4) => )
  • Left, right memoryAlpha, Beta memory
  • First Beta: dummy

ConfSet 1

Expert Systems 4

an eye on efficiency

Facts matching condition i

An eye on efficiency
  • Compare: #Ai #Bi (neigh ?x ?y)n-1 n-1(holds ?x ?a)n n-1(holds ?y ?b)n n-1
  • To:(holds ?x ?a)n n(holds ?y ?b)n n2(neigh ?x ?y)n-1 n-1
  • Put first: Conditions that rarely match facts
  • Put first: Conditions that restrict subsequent facts
  • Put last: Conditions matching volatile facts

Fact combinations matching first i cond.

#Bi < #Ai * #Bi-1

Expert Systems 4

summary and conclusions
Summary and conclusions
  • Language processing in Façade:Pragmatic language level is important for intelligent reaction
  • Mapping to pragmatics is implemented with rules
  • Knowledge acquisition usually requires to represent knowledge at a level higher than rules
  • Interpreters spend their time in Matching
  • Rete Algorithm avoids within-cycle and between-cycle redundancy
  • Know and use its properties to tune for efficiency

Expert Systems 4