Semantic Analysis: Natural Language Processing (CSE 5321)
Semantic Analysis: Natural Language Processing (CSE 5321)
Semantic Analysis: Natural Language Processing (CSE 5321)
Introduction to Semantics
Syntactic Analysis
Parse tree
Semantic Analysis
Context-independent meaning +
Other relevant information
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 2/35
Introduction
Introduction to Semantics
Semantic Representation and Interpretation
Cultural Analysis and Linguistic Semantics
Lexical Semantics
Linguistic Universals
Latent Semantic Analysis
• There is a close link between the life of the society and the lexicon of the language
spoken.
For example:
ice, snow
politeness in Amharic, not in English
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 3/35
Introduction
Introduction to Semantics
Semantic Representation and Interpretation
Cultural Analysis and Linguistic Semantics
Lexical Semantics
Linguistic Universals
Latent Semantic Analysis
Linguistic Universals
• This theory is based on the notion of semantic primitives which are claimed to have the
following properties:
Universally meaningful concepts
Do not need definition in terms of other words
Represent basic concepts
Reduce a language into a core that enables the full development of the
language (Natural Semantic Metalanguage, NSM)
Every language has essentially the same NSM though the syntax may differ.
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 4/35
Introduction
Introduction to Semantics
Semantic Representation and Interpretation
Cultural Analysis and Linguistic Semantics
Lexical Semantics
Linguistic Universals
Latent Semantic Analysis
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 5/35
Introduction
Introduction to Semantics
Semantic Representation and Interpretation
Cultural Analysis and Linguistic Semantics
Lexical Semantics
Linguistic Universals
Latent Semantic Analysis
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 6/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Semantic Roles
• A semantic role is the underlying relationship that a participant has with the main verb
in a clause.
Semantic roles are identified from the grammatical relations.
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 7/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 8/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
• The notions of actor and undergoer capture generalizations across verb types that are
expressed by underlying grammatical relations.
• Actors are distinguished from subject and undergoer from direct object.
• The syntactic subject can be either an actor (active voice) or an undergoer (passive
voice).
• In clauses with intransitive verbs, the syntactic subject may be either an actor or an
undergoer, depending upon the class of the verb
• Examples:
Active voice: “Abebe killed the lion.”
“Abebe” is the syntactic subject and “the lion” is syntactic direct object.
“Abebe” is the actor and “the lion” is the undergoer.
Passive voice: “The lion was killed by Abebe.”
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 9/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Representing Meaning
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 10/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
• Given a set of semantic roles, how can we assign grammatical relations with semantic
roles and represent meaning?
There are no specialized mechanisms of semantic role assignment.
Everything is predication.
A function returning a Boolean is called a predicate.
For example, “Abebe ate besso” can be represented as “ate(Abebe, besso)”.
But, what are the possible arguments?
Predicate arguments can be complicated.
Nouns (entities/instances) take no arguments.
Verbs (event) are predicational, and take one argument, a complement.
Prepositions (relations) are relational, and take two arguments.
Adjectives (states) are predicational, and take one argument, but require some
help; thus an adjective is always the complement of a verb, which then projects
for an external argument.
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 11/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
• Examples:
Abebe ate besso
thing(besso)
ate(Abebe,x) ^ thing(x)
Brown fox
Brown(x) ^ fox(x)
• Not ideal as a meaning representation and doesn't do everything we want - but close
Supports the determination of truth
Supports compositionality of meaning
Supports question-answering (via variables)
Supports inference
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 12/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Connective → ∨ | ∧|⇒
Quantifier → ∃| ∀
Constant → A | Abebe | Car1
Variable → x | y | z |...
Predicate → Red | Owns | Serves| Near |...
Function → FatherOf | Plus | LocationOf |...
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 13/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Elements of FOPC
• Terms are names used to represent objects.
Constants
Refer to specific object in the world being described.
Conventionally depicted as single capitalized letters such as A and B or
single capitalized words like Abebe.
For example: Abebe, Car1
Functions
Correspond to concepts that are often expressed as possessives.
Provide a convenient way to refer to specific objects without having to
associate a named constant with them.
For example: LocationOf(AAU), FatherOf(Abebe), Plus(1,2)..
Variables
Used to make assertions and draw inferences about objects without having
to make any reference to any particular named object.
Making statements about a particular unknown object;
Making statements about all the objects in some world of objects.
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 14/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Elements of FOPC
• A predicate represents a property of or relation between terms that can be true or false.
In a given interpretation, an n-ary predicate can defined as a function from tuples
of n terms to {True, False}
For example: Brother(Abebe, Kebede), Left-of(Square1, Square2),
GreaterThan(plus(1,1), plus(0,1))
P Q ¬P P∧
∧Q P∨
∨Q P⇒
⇒Q
F F T F F T
F T T F T T
T F F F T F
T T F T T T
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 15/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Elements of FOPC
• An atomic sentence is simply a predicate applied to a set of terms.
For example: Owns(Abebe, Car1)
Sold(Abebe, Car1, Kebede)
Semantics is True or False depending on the interpretation
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 16/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Elements of FOPC
• Quantifiers allow statements about entire collections of objects rather than having to
enumerate the objects by name.
Universal quantifier: ∀
Asserts that a sentence is true for all values of variable x
For example: ∀x Loves(x, FOPC)
∀x Whale(x) ⇒ Mammal(x)
∀x Birds(x) ⇒ Black(x)
Existential quantifier: ∃
Asserts that a sentence is true for at least one value of a variable x.
∃x Loves(x, FOPC)
∃x(Cat(x) ∧ Color(x,Black) ∧ Owns(Abebe,x))
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 17/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Elements of FOPC
• Universal and existential quantification are logically related to each other:
∀x ¬Love(x,Abebe) ⇔ ¬∃x Loves(x,Abebe)
∀x Love(x,Kebede) ⇔ ¬∃x ¬Loves(x,Kebede)
• General Identities
∀x ¬P ⇔ ¬∃x P
¬∀x P ⇔ ∃x ¬P
∀x P ⇔ ¬∃x ¬P
∃x P ⇔ ¬∀x ¬P
∀x P(x)∧Q(x) ⇔ ∀xP(x) ∧ ∀xQ(x)
∃x P(x)∨Q(x) ⇔ ∃xP(x) ∨ ∃xQ(x)
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 18/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Examples
• Sheraton Addis is a hotel
Hotel(SheratonAddis)
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 19/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Examples
• A hotel that serves Ethiopian food near AAU
∃xHotel(x) ∧ Serves(x,EthiopianFood) ∧ Near(LocationOf(x),LocationOf(AAU))
If Sheraton Addis is a hotel that serves Ethiopian food near AAU, substituting
Sheraton Addis for x results in the following:
Hotel(SheratonAddis) ∧ Serves(SheratonAddis,EthiopianFood) ∧ Near(LocationOf(SheratonAddis),
LocationOf(AAU))
Every substitution of a known object for x must result in a sentence that is true.
EthiopianHotel(SheratonAddis) ⇒ Serves(SheratonAddis,EthiopianFood)
EthiopianHotel(HiltonAddis) ⇒ Serves(HiltonAddis,EthiopianFood)
EthiopianHotel(Ghion) ⇒ Serves(Ghion,EthiopianFood)
.
.
.
.
.
.
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 20/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Examples
What happens when we consider a substitution from a set of objects that are
not Ethiopian hotels?
EthiopianHotel(KampalaSheraton) ⇒ Serves(KampalaSheraton, EthiopianFood)
EthiopianHotel(NairobiHilton) ⇒ Serves(NairobiHilton, EthiopianFood)
.
.
.
.
The sentence is always true
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 21/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Notes
• Variables in logical formula must be either existentially (∃) or universally (∀) quantified.
• To satisfy an existentially quantified variable, there must be at least one substitution
that results in a true sentence.
• Sentences with universally quantified variables must be true under all possible
substitutions.
• Limitations:
If you are interested in a football, Ethiopian Coffee is playing today
HaveInterestIn(Hearer, Football) ⇒ Playing( EthiopianCoffee, Today)
Flawed if the antecedent is false.
One more beer and I will fall off this stool
A simple-minded translation of this sentence might consist of a
conjunction of two clauses.
The use of the word and obscures the fact that this sentence in stead has
an implication underlying it.
Your money or your life!
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 22/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
Lambda Calculus
• Lambda Calculus
A formal system designed to investigate function definition, function application
and recursion.
• Examples:
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 23/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
ate(Abebe, besso)
S* = VP* (NP*) = λy ate(y, besso)(Abebe) = ate(Abebe, besso)
ate besso
λxλy = ate(x, y) λx(x), x = besso
Department of Computer Science, Addis Ababa University Lecture 04: Semantic Analysis 24/35
Semantic Roles
Introduction
Representing Meaning
Semantic Representation and Interpretation
First Order Predicate Calculus
Lexical Semantics
Lambda Calculus
Latent Semantic Analysis
Semantic Networks
• Verb phrases return λ-functions as their results (in fact – higher order)
• Application of the lambda form is associated with the VP to the lambda form given by
the argument NP.
• This predicate can then be evaluated against a database – this is model interpretation
to return a value, or TRUE or FALSE, etc.
Semantic Networks
has is a
has
• A semantic network is used when one has knowledge that is best understood as a
set of concepts that are related to one another.
• Lexicon has a highly systematic structure that governs what words can mean and how
they can be used.
• The structure of a lexicon consists of relations among words and their meanings, as
well as the internal structure of individual words.
• Lexical Semantics is the linguistic study of the systematic and meaning related
structure of the lexicon.
• Homonymy: refers to the relation that holds between words that have the same form
but different meaning.
• Example: 1. A bank can hold the investments in a custodial account in the client’s
name.
2. As the agriculture burgeons on the east bank, the river will shrink more.
This relationship is traditionally denoted by placing a superscript on the
orthographic form of the word as bank1 and bank2.
This notation indicates that these are two separate lexemes, with distinct and
unrelated meanings, that happen to share an orthographic form.
• Homophones: words with the same pronunciation but different spellings.
Example: to, two, too [too]
• Homographs: words with the same orthographic forms but different pronunciation.
Example: desert [dizurt/dezurt]
• Polysemy: refers to the relation that holds within a single lexeme with multiple
related meanings.
• Example: 1. A bank can hold the investments in a custodial account in the client’s
name.
• To distinguish homonymy from polysemy, two criteria are used: history and etymology
of the lexeme in question.
For example, etymology reveals that bank1 and bank2 have Italian and
Scandinavian origins, respectively.
However, the use of banks (as in blood bank) is related to the sense of bank1,
and therefore there is no need to consider the usage of banks as homonym to
bank1.
• Synonymy: refers to the relation that holds between different lexemes with the same
meaning.
• Examples:
• Examples:
human, hominid
teacher, educator
• Latent Semantic Analysis (LSA) aims to discover something about the meaning
behind the words; about the topics in the documents.
• What is the difference between topics and words?
Words are observable
Topics are not observable; they are latent.
• How to find out topics from the words in an automatic way?
We can imagine them as:
a compression of words
a combination of words
• Implements the idea that the meaning of a passage is the sum of the meanings of
its words:
meaning(word1) + meaning(word2) + … + meaning(wordn) = meaning(passage)
• This “bag of words” function shows that a passage is considered to be an unordered
set of word tokens and the meanings are additive.
• By creating an equation of this kind for every passage of language that a learner
observes, we get a large system of linear equations.