NLP Unit-2 Notes
NLP Unit-2 Notes
Processing
KOE-088
Unit2
Prepared by Sandhya Avasthi, AP, Department of CSE
Topics Covered in Unit 2
✓Introduction to semantics
✓Linking syntax and semantics
✓Ambiguity resolution, Semantic Representation
✓Strategies for knowledge representation
✓Knowledge representation
✓Reasoning
✓Applications
✓Machine translation
✓Database interface
Introduction to semantics
• Semantics is the study of linguistic meaning
• It examines what meaning is, how words get their meaning, and how the
meaning of a complex expression depends on its parts.
• Part of this process involves the distinction between sense and reference
• Semantics contrasts with syntax, which studies the rules that dictate how to
create grammatically correct sentences, and pragmatics which investigates
how people use language in communication.
Lexical Semantics
• Lexical semantics is branch of semantics that studies word meaning
• It examines whether words have one or several meanings and in
what lexical relations they stand to one another.
• Phrasal semantics exploring the phenomenon
of compositionality or how new meanings can be created by
arranging words.
• Formal semantics relies on logic and mathematics to provide
precise frameworks of the relation between language and meaning.
• Cognitive semantics examines meaning from a psychological
perspective and assumes a close relation between language ability
and the conceptual structures to understand the world.
Semantic processing
• Permit us to reason about their truth (i.e., their relationship to some world)
• Permit us to answer questions based on their content
• Permit us to perform inference (answer questions and determine the truth of
things we don’t already know to be true)
FOL-
Inference through Modus ponens
• Inference — Ability to add valid new propositions to a knowledge base, or to
determine the truth of propositions not explicitly contained within a knowledge
base.
• Modus ponens is a familiar form of inference that MODUS corresponds to what
• PONENS is informally known as if-then reasoning
1. Since it is not present in the knowledge base, a search for applicable rule is initiated
resulting in rule
2. After substituting constant Leaf for ‘x’, antecedent of rule VegetarianRestraurant(Leaf)
truthness is checked, which is TRUE.
3. Hence given proposition is TRUE.
Event and State Representations
• States are conditions or properties that remain unchanged
• Events denote changes in some state of affairs
• The representations of both can involve a host of participants, props,
times and locations.
• it consists of of single predicates with as many arguments as needed
to incorporate all the roles associated with example.
FOL Representation-
English Tense Logic
Reference Point- the current moment in time is equated with time of utterance and is used as
reference point when the event occurred (before, at or after).
Semantics of various logical connectives
Aspect
• This concerns a cluster of related topics including whether an event
has ended or is ongoing.
• Whether it is conceptualized as happening at a point in time or over
some interval.
• Based on these notion event expressions is divided into four general
classes….
Stative- I know my departure gate
Activity- John is flying
Accomplishment- Sally booked her flight
Achievement- She found her gate
Stative expressions
• Represents the notion of an event participant having a particular
property or being in a state, at a given point of time.
• These expressions can be thought of as capturing an aspect of a world
at a single point in time.
• Participant can be seen as experiencing something.
Example-
I like flight 840 arriving at 10:06
I need the cheapest fare
I want to go first class
Activity Expressions
• These describes events undertaken by a participant and have no particular
end point.
• Unlike statives activities are seen as occurring over some span of time and
therefore not associated with single points in time.
Example-
She drove a Mazda
I live in Brooklyn
She lives in New Delhi.
She drove her SUV for an hour
Description Logics(1)
• Some other representational schemes are semantic network and frames.
• Frames are also known as slot-filter representations.
Semantic Networks- objects are represented as nodes in a graph with
relations between objects being represented by named links.
Frame-based systems- objects are represented as feature structures.
Features are called slots and the values, or fillers of these slots can either be
atomic values or other embedded frames.
• When using Description Logics to model an application domain, emphasis is
given on representation of knowledge about categories, individuals that belong
to those categories and relationship that can hold among these individuals.
• Set of categories, or concepts is called it terminology.
Description Logics(2)
• Portion of knowledge base that contain terminology is called TBox
• Facts about individuals is called ABox.
• Terminology is arranged into a hierarchical organization called an ontology
• Ontology captures the subset/superset relations among the categories.
• After specifying categories of interest , next step is to arrange categories into
hierarchy.
• There are two ways to do it---
-directly assert relations between categories that are related
-provide complete definitions of the concepts, then rely on it to infer
What is Ontology?(1)
An ontology specifies a rich description of the
• Terminology, concepts, nomenclature
• Properties explicitly defining concepts
• Relations among concepts ( hierarchical and lattice)
• Rules distinguishing concepts, refining definitions and relations ( constraints,
restrictions and regular expressions)
All these related to a specific domain.
What is Ontology?(2)
• Ontologies provide a common vocabulary for use by independently developed
resources, processes, services
• Agreements among organizations sharing common services can be made with regard
to their usage; the meaning of relevant concepts can be expressed unambiguously
• By composing/mapping ontologies and mediating terminology across participating
events, resources and services, independently developed services can work together
to share information and process consistent accurately and completely.
• Ontologies also ensure
- valid conversations among agents to collect, process, fuse and exchange
information
-accurate searching by ensuring context using concept definitions and relations
instead of/in addition to statistical relevance of keywords.
Semantic Network
• A semantic network or net is a graph structure for representing knowledge in
patterns of interconnected nodes and arcs.
• it is a declarative graphic representation that can be used to represent
knowledge and support automated systems for reasoning about knowledge.
• It is a directed or undirected graph consisting of vertices, which
represent concepts, and edges, which represent semantic
relations between concepts
• Six types are definitional, assertional, implicational, executable, learning and
hybrid semantic networks
Semantic Network for financial Product
• financial products can be described
by their duration, risk level, and
other characteristics
• a mortgage is a financial product
that is long-term and has a
dependency on other financial
products such as home insurance,
life insurance, and current
accounts.
• An example of a long-term loan is a
mortgage, and an example of a
low-risk investment is a
government bond.
1. Definitional networks
▪ It emphasize the subtype or is-a relation between a concept type and a newly defined
subtype.
▪ It is called a generalization or subsumption hierarchy
▪ It supports the rule of inheritance for copying properties defined for a supertype to all
of its subtypes.
▪ Since definitions are true by definition, the information in these networks is often
assumed to be necessarily true.
2. Assertional networks
• are designed to assert propositions.
• Unlike definitional networks, the information in an assertional network is assumed to be
contingently true, unless it is explicitly marked with a modal operator.
• Some assertional networks have been proposed as models of the conceptual structures
underlying natural language semantics.
Semantic Network Types
3. Implicational networks use implication as the primary relation for
connecting nodes. They may be used to represent patterns of beliefs,
causality, or inferences.
4. Executable networks include some mechanism, such as marker
passing or attached procedures, which can perform inferences, pass
messages, or search for patterns and associations.
5. Learning networks build or extend their representations by acquiring
knowledge from examples. The new knowledge may change the old
network by adding and deleting nodes and arcs or by modifying
numerical values, called weights, associated with the nodes and arcs.
6. Hybrid networks combine two or more of the previous techniques,
either in a single network or in separate, but closely interacting
networks.
Pipeline of Semantic Analysis
• syntactic analysis of an input sentence will form the input to a semantic analyzer.
• An input is first passed through a parser to derive its syntactic analysis.
• This analysis is then passed as input to a semantic analyzer to produce a meaning
representation.
• Note that although this diagram shows a parse tree as input, other syntactic
representations such as feature structures, or lexical dependency diagrams, can be
used.
Compositional Analysis
• Principle of Compositionality
• The meaning of a whole is derived from the meanings of the parts
• What parts?
• The constituents of the syntactic parse of the input
• What could it mean for a part to have a meaning?
Example AyCaramba serves meat.
• A semantic analyzer given this tree as input proceed by first retrieving a meaning
representation from subtree corresponding to the verb serves
• Analyzer next extracts meaning representations corresponding to two noun phrases in the
sentence.
• Then using the representation acquired from the verb as a template, the noun phrase meaning
representations can be used to bind the appropriate variables in the verb representation
• thus producing the meaning representation for the sentence as a whole