examples of communication: body language - · pdf fileexamples of communication: body language...

18
2D1380 Artificial Intelligence: Lecture 9 Communication Patric Jensfelt [email protected] September 30 July 2005 Communication Communication: Intentional exchange of information using signs from a shared system of conventional symbols. Can for example help agents to get information from others without having to directly observe themselves Ex: Don’t have to get out of bed, can ask about the weather Can be seen as an action for the agent Examples of communication: Human speech Examples of communication: Body language

Upload: dangkhue

Post on 17-Mar-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

2D1380 Artificial Intelligence: Lecture 9

Communication

Patric [email protected]

September 30 July 2005

Communication

I Communication: Intentional exchange of information usingsigns from a shared system of conventional symbols.

I Can for example help agents to get information from otherswithout having to directly observe themselvesEx: Don’t have to get out of bed, can ask about the weather

I Can be seen as an action for the agent

Examples of communication: Human speech Examples of communication: Body language

Page 2: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Examples of communication: Gestures

I Depends on situation

Examples of communication: Gestures

I Depends on situation, country, etc

I Check out http://en.wikipedia.org/wiki/Gesture

Examples of communication: Signs

I Example: STOP

I Example: warning for mothers with lunch bags?

Examples of communication: AnimalsI Animals with sound, gestures, acts, etc

Page 3: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Examples of communication: Bees

I Bees communicating way home, direction to nectar, etc

Animals

I Animals typically uses isolated symbols for sentencesI Restricted set of communication propositionsI No generative capability

Speech act

I Communication action for agent: speech actI Many forms of communication as we have seenI To change state of other agents and their future actionsI The speech act

I SpeakerI UtteranceI Hearer

Speech acts

I Different objectives for speakerInform “Dani will give the next lecture”Query “Am I speaking loud enough?”Command “Don’t fall asleep!”Promise “We will not fall asleep”Acknowledgement “OK, message received”, ACK/NACK

Page 4: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Speech act

I Speaker must determineI When to use a speech actI Which speech act to use

I Hearer mustI UnderstandI Speech is planned action ⇒ Recognize plan increases

understanding of speech

Language

I Formal languagesI For example first-order logic, java, etcI Have strict definitions

I Natural languagesI For example English, Swedish, etcI No strict definitions

Semantics

I Semantics - meaning to each valid stringI “X + Y ” sum of X and Y in arithmetic

I warning survey workers on the road

Formal language

I Defined as a set of stringsI Each string is a concatenation of terminal symbols (words)I Ex: P and ∧ terminal symbols of first-order logic

“P ∧Q” a typical valid string“PQ∧” is an invalid string

Page 5: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Grammar

I Grammar is a finite set of rules that specifies a languageI Each string in the language can be analyzed/generated by

the grammarI Formal languages have official grammars e.g. first-order

logic, ANSI-CI Natural languages have no official grammar

(some foreign language teacher may disagree)

Phrase structure

I Strings are composed of substring or phrases

English phrase structure

I Noun phrase (NP) such as “Patric”I Verb phrase (VP) such is “is hungry”I Sentence (S)I NP and VB help describe the allowable strings

“Patric︸ ︷︷ ︸NP

is hungry︸ ︷︷ ︸VP

” and not “hungry Patric is”

Nonterminal symbols

I NP, VP and S are nonterminal symbolsI Nonterminals are defined by rewrite rulesI S can consist of any NP followed by any VP

Page 6: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Backus-Naur Form (BNF)

I Using Backus-Naur form (BNF) notation for rewrite rulesI BNF has four components

I A set of terminal symbolsSymbols or words that make up the stringsin English letters (a,b, . . . ) or words (apple,banana,. . . )

I A set of nonterminal symbolsCategorize substrings of the languagein English “is hungry” is a Verb phrase

I A start symbolNonterminal symbols that denotes a complete stringIn English it is a sentence

I A set of rewrite rulesSentence → NounPhrase VerbPhrase

Using BNF

I S can consist of any NP followed by any VPI BNF: S → NP VP

BNF Ex: Rewrite rule of simple arithmetics

Expr → Expr Operator Expr | (Expr) | NumberNumber → Digit | Number DigitDigit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9Operator → + | - | ÷ | ×

Generative capacity of grammar

I Grammar can be classified according to their generativecapacity: the set of languages they can represent

I Chomsky suggested a hierarchy with four classes ofgrammars

I Grammar higher up in hierarchy more expressive, butI Algorithms for these are less efficient

Page 7: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Chomsky’s grammar hierarchy (most powerful first)

I Recursively enumerable grammarsUnrestricted rules, any number of symbols on left and rightside

I Context-sensitive grammarsRight hand side of rules at least as many as leftEx: A S B → A X B

I Context-free grammars (CFG)Left hand side a single nonterminal symbolEx: S → NP VPCan rewrite left hand side as right hand side in any context

I Regular grammarsEach rule has one left hand side nonterminalRight hand side terminal optionally followed by nonterminal

Stages in communication

I Speaker:I Intention

S wants to inform H that PI Generation

S selects words W to express P in context CI Synthesis

S utters words WI Hearer:

I PerceptionH perceives W’ in context C’

I AnalysisH infers possible meanings P1, P2, . . . , Pn

I DisambiguationH infers intended meaning Pi

I IncorporationH incorporates Pi into KB

Analysis

I Three main partsI Syntactic interpretation (build a parse tree)I Semantic interpretation (what does it means)I Pragmatic interpretation (what does it mean in this context)

Ex: “I am looking at the diamond”Jeweler: the diamondBaseball player: the baseball field

Ex: Wumpus world

I Paul wants to tell Frank that the wumpus is dead

Page 8: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Ex: Wumpus world What could go wrong

I Insincerity (S is lying)I Ambiguous utterance (“I am dead” dead or just tired?)I Different understanding of current context (C 6= C′)

Small grammar for English

I Formal grammar for English in wumpus worldI We will call the language E0

I Cannot make full grammar for EnglishI People have different ideas of what is proper/valid English

Lexicon for E0

Noun → stench | breeze | glitter | nothing

| wumpus | pit | pits | gold | east | . . .

Verb → is | see | smell | shoot | feel | stinks

| go | grab | carry | kill | turn | . . .

Adjective → right | left | east | south | back | smelly | . . .

Adverb → here | there | nearby | ahead

| right | left | east | south | back | . . .

Pronoun → me | you | I | it | . . .

Name → John | Mary | Boston | UCB | PAJC | . . .

Article → the | a | an | . . .

Preposition → to | in | on | near | . . .

Conjunction → and | or | but | . . .

Digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Divided into closed and open classes

Page 9: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Grammar for E0

S → NP VP I + feel a breeze| S Conjunction S I feel a breeze + and +

I smell a wumpus

NP → Pronoun I| Noun pits| Article Noun the + wumpus| Digit Digit 3 4| NP PP the wumpus + to the east| NP RelClause the wumpus + that is smelly

VP → Verb stinks| VP NP feel + a breeze| VP Adjective is + smelly| VP PP turn + to the east| VP Adverb go + ahead

PP → Preposition NP to + the eastRelClause → that VP that + is smelly

Problems with this grammar

I OvergeneratesGenerates sentences that are not correct“Me go Boston” or “I smell pit gold wumpus nothing east”

I UndergeneratesRejects many correct sentences“I think the wumpus is smelly”

Augmented grammar

I Want to get rid of non-English sentences“Me is tired”

I “Me” is objective case and “I” is subjective caseI Cannot use objective case as subject!I Introduce new categorizes for pronouns

PronounS → I | you | he | she | it | . . .PronounO → me | you | him | her | it | . . .

I Now we can split NPNPS → PronounS | Name | Noun | . . .NPO → PronounO | Name | Noun | . . .

Augmented grammar: Agreement

I Still not enoughI Ex: “I eats” not OK, but “He eats” OKI Three forms “I am”, “You are” and “He is”I For each subject and object form there are three of these

agreement distinctionsI Many more distinctions to be madeI Results in exponential increase in rules!

Page 10: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Augment existing grammar

I Don’t enumerate all possible casesI Parameterize existing grammar instead

Ex: NP(case) → Pronoun(case) | Name | Noun | . . .I Called definite clause grammar (DCG)

Parsing

I Parsing aims at finding a parse treeI The leafs in the tree are the words in the string

Parsing cont’d

I Two extremesI Top-down parsing

Start with S and search for tree with leafs being the wordsI Bottom-up parsing

Start with words and look for tree with root S

Top-down parsing

I Initial stateroot S and unknown children [S:?]

I Successor functionReplace ? with list of right hand side from grammar for acertain parent nodeEx:

1. [S :?]2. [S : [S :?][Conjunction :?][S :?]]

[S : [NP :?][VP :?]]3. . . .

I Goal testLeafs corresponds exactly to words in string

Page 11: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Bottom-up parsing

I Initial stateEach word its own parse tree

I Successor functionLook for matches from right side of grammar and replacewith new tree where the category is the left hand side andthe subsequences are the children

I Goal testChecks single tree with root S

Ex: Bottom-up parsing

Ex: Bottom-up parsing Ex: Bottom-up parsing

Page 12: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Ex: Bottom-up parsing Ex: Bottom-up parsing

Improvements needed

I Both top-down and bottom-up can be very inefficientI Huge amount of different parses for different phrasesI Some sentences have exponentially many parse treesI See book for suggested improvementsI For example store intermediate results of substrings

Semantics

I Ex: “John loves Mary”I How to get to the logical sentence Loves(John, Mary)?I “John︸ ︷︷ ︸

NP

loves Mary︸ ︷︷ ︸VP

I NP “John” corresponds to logical term JohnI VP “loves Mary” is trickier

Page 13: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Predicate

I We call “loves Mary” a predicateI Combined with person it gives a logical sentenceI Can use λ-notation

λx Loves(x , Mary)

I Can make predicates out of verbs as well“loves” ⇒ λy λx Loves(x , y)

I “loves Mary” ⇒ λx Loves(x , Mary)

Parse tree for “John loves Mary”

Semantics

I Also need to account forI Time and tense, e.g. “Loves” and “Loved”I Quantification, e.g. “Everyone loves someone”

Do we love the same person or do we each have our ownlove?

Parsing real languages

I AmbiguityI AnaphoraI IndexicalityI VaguenessI MetonymyI MetaphorI Noncompositionality

Page 14: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Example: Ambiguity

I Example of ambiguity:I Squad helps dog bite victimI Helicopter powered by human fliesI American pushes bottle up GermansI I ate spaghetti with meatballs

salada forka friend

I Ambiguity can be lexical (polysemy), syntactic, semantic,referential

Anaphora

I Using pronouns to refer back to entities already introducedin the text

I Examples:I After Mary proposed to John, they found a preacher and

got married.I For the honeymoon, they went to HawaiiI Mary saw a ring through the window and asked John for itI Mary threw a rock at the window and broke it

Indexicality

I Indexical sentences refer to utterance situations (place,time, S/H, etc)

I Examples:I I am over hereI Why did you do that?

Metonymy

I Use one noun to stand for anotherI Examples:

I I dropped Russell and Norvig on the floorI The ham sandwich on table 4 wants another beer

Page 15: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Metaphor

I “Non-literal” usage of words and phrases, often systematicI Examples:

I Men are pigsI You are my sunshineI I’ve tried killing the process but it won’t die. Its parents

keeps it alive

Examples: Noncompositionality

I Example noncompositionalityI basketball shoesI baby shoesI alligator shoesI designer shoes

I red bookI red penI red hairI red herring

I small moonI large molecule

Example: Not keeping the words together

I English influence large in Swedish languageI Swedes have a tendency to not keep the words togetherI Can change the meaning completely

I En brunhårig sjuksköterska ⇒ A nurse with brown hairI En brun hårig sjuk sköterska ⇒ A brown hairy sick nurse

I More examples:I KYCKLING LEVER - “Chicken is alive” instead of “chicken

liver”I BAD SHORTS - “asked the shorts” instead of “swimming

shorts”I HUGG ORM - “stabbed the snake” instead of “viper”I SKUM TOMTE - “weird santa” instead soft candy in the

shape of santaI RÖK FRITT - “smoke freely” instead of “free from smoking”I http://www.skrivihop.nu/

Disambiguation

I Disambiguation requires knowledge of different kindI World model

Likelihood that it occurs in the worldI Mental model (of the speaker)

Would the speaker communicate this if it occurs?I Language model

Likelihood to choose certain string of words given what tocommunicate

I Acoustic modelLikelihood that a particular sound will be generated giventhe string of words

Page 16: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Probabilistic Language Processing

I Idea: Instead of building up very complicated grammars fornatural language, learn from text written by humans

I So called corpus-based approachI Building probabilistic modelI The WWW provides enormous amount of training dataI Roughly: Count occurrences to get estimate of probabilityI Can handle any stringI Can handle many views on what is correct

Probabilistic language model

I Defines the probability distribution over a set of strings(Can be infinite set of strings)

I Examples:I unigram model

Assign probability to each wordEach words treated independently, P(S) =

∏i P(wi)

I bigram modelAssign probabilities P(wi |wi−1) to a word wi

I n-gram modelAssign probabilities P(wi |wi−1, wi−2, . . . , wi−n)

Examples of models

I Examples with AI-book as corpusI unigram

logical are as are confusion a may right tries agent goal thewas diesel more object then information-gathering searchis

I bigramplanning purely diagnostic expert systems are very similarcomputational approach would be represented compactlyusing tic tac toe a predicate

I trigramplanning and scheduling are integrated the success ofnaive bayes model is just a possible prior source by thattime

I Trigram model clearly best and so say the modelsI trigram P(S) = 10−10

I bigram P(S) = 10−29

I unigram P(S) = 10−59

AI-book as corpus

I Approximately 500,000 wordsI 15,000 different wordsI ⇒ bigram model has 225 million word pairs in modelI Most of these pairs will never occurI However, cannot assign the to zeroI Would make it impossible to generate then

Page 17: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Smoothing

I Need to smooth our modelI Simplest strategy: add-one smoothing

I every bigram gets at least count 1I Results often not so good

I Better strategy: line interpolation smoothingI Combine unigram, bigram and trigramsI P̂(wi |wi−1, wi−2) =

c1P(wi) + c2P(wi |wi−1) + c3P(wi |wi−1, wi−2)

SCIgen - An Automatic CS Paper Generator

I Example: System that can automatically generate a paperon computer science

I Full length paper with figures, references, etcI http://pdos.csail.mit.edu/scigen/

Evaluation

I Split corpus in two partsI training dataI validation data

I Learn model on training dataI Calculate probability that the model assigns to the

validation data (that we assume is correct)I The higher score the betterI Problems with long strings

see for example perplexity in the book (2−log2(P(words))/N )

Examples of using corpus based approach

I Information retrievalI Information extractionI Machine translation

Page 18: Examples of communication: Body language - · PDF fileExamples of communication: Body language Communication I Communication: Intentional exchange of information using signs from a

Information retrieval (IR)

I Find information in corpus of interest to useI Compare googleI Characterized by

I Document collection (corpus)I Query language (how to ask for information)I Result set (relevant documents)I Presentation of results (ranking?)

I Typically rather simple language models(huge amount of data!)

Evaluating IR systems

I RecallHow many of the relevant document are in the result set?(Return all documents give 100% recall)

I PrecisionHow many documents in result set are relevant?(Return all documents give ≈0% precision)

I Recall and precision typically presented in ROC curvefalse negatives on y (good recall gives few false neg)false positives on x (good precision gives few false pos)

I Time to answerI Average reciprocal rank

average 1rank of first relevant

Information extraction

I Create database entries by searching for informationautomatically

I For example pricerunnerI Do not have to analyze everything in a document

Machine translation

I Translate text from one natural language to anotherI Some example tasks:

I Rough translationTo get an idea of what a piece text is about

I Restricted-source informationAccurate translation of material in limited area (weatherreports)

I Preedited translationHuman preedits the text to a subset of the original languageEx: Instruction manual

I Literary translationPreserve all nuances in the translationNot possible today!

I http://world.altavista.com/