You are on page 1of 28

Lecture 02

Components of NLP

Natural Language Processing


COSC-3121
Ms. Humaira Anwer
Humaira.anwer@kfueit.edu.pk

Lecture 02 Components of NLP 1


Agenda
• Components of NLP
• Levels of Ambiguity
• Knowledge of Language
• Resolving Ambiguities

Lecture 02 Components of NLP 2


Components of NLP
• There are two components of NLP as given:
• Natural Language Understanding (NLU)
• Natural Language Generation (NLG)

Lecture 02 Components of NLP 3


NLP

Lecture 02 Components of NLP 4


Components of NLP

Lecture 02 Components of NLP 5


Natural Language Understanding
(NLU)
• Understanding involves the following
tasks:
• Mapping the given input in natural
language.
• Analyzing different aspects of the
language.

Lecture 02 Components of NLP 6


Natural Language Generation
(NLG)
• It is the process of producing meaningful phrases
and sentences in the form of natural language from
some internal representation.
• It involves:
• Text planning − It includes retrieving the relevant
content from knowledge base.
• Sentence planning − It includes choosing required
words, forming meaningful phrases, setting tone of the
sentence.
• Text Realization − It is mapping sentence plan into
sentence structure.
• Which is harder? NLU or NLG?
Lecture 02 Components of NLP 7
Difficulties in NLU
• NL has an extremely rich form and structure
• How to represent meaning,
• Which structures map to which meaning structures.
• One input can mean different meanings.
• Many inputs can mean the same thing.
• It is very ambiguous.

Lecture 02 Components of NLP 8


Ambiguity in NLU
• The ability of being understood in more than one
way
• If humans find it difficult to deal with ambiguity in
conversations, just imagine the challenge for NLU
systems

Lecture 02 Components of NLP 9


Levels of Ambiguity in NLU
• NLP has the following levels of ambiguities −
• Lexical Ambiguity
• Syntactic Ambiguity
• Referential Ambiguity
• Pragmatic Ambiguity

Lecture 02 Components of NLP 10


Lexical Ambiguity
• Lexical ambiguity − It is at very
primitive level such as word-level
• Occurs when word is polysemous
• For example, the word “silver” can be
treated as noun adjective or verb?
• She bagged two silver medals. [Noun]
• She made a silver speech. [Adjective]
• His worriers had silvered his hair. [Verb]
• She bought silver balloons. [Adjective]
Lecture 02 Components of NLP 11
Examples of Lexical Ambiguity

Lecture 02 Components of NLP 12


Syntactic/Structural Ambiguity
• Syntactic ambiguity − A sentence can be
parsed in different ways
• Occurs when grammatical arrangement of
words makes the meaning of sentence
unclear
• The meaning of each word can be clear but
we cannot understand the overall sense.
• For example, “The Chicken is ready to eat.”
• We can eat the Chicken now
• The Chicken wants to eat now

Lecture 02 Components of NLP 13


Lecture 02 Components of NLP 14
Example of Syntactic Ambiguity
• I made him hen
• Some interpretations of : I made him hen.
1. I cooked hen for him.
2. I cooked hen belonging to him.
3. I created a toy hen which he owns.
4. I caused him to quickly lower his head or body.
5. I used magic and turned him into a hen.

Lecture 02 Components of NLP 15


I made him hen
• Hen – morphologically and syntactically
ambiguous:
noun or verb.
• him – syntactically ambiguous: noun, pronoun or
possessive.
• make – semantically ambiguous: cook or create.
• make – syntactically ambiguous:

Lecture 02 Components of NLP 16


Referential/Anaphoric/ Discourse
Ambiguity
• Referential ambiguity − Referring to
something using pronouns.
• More than one object is being referred to by a noun
phrase
• Occurs as a result of using anaphoric
expressions.
• The use of an expression whose interpretation depends
upon another expression in context

Lecture 02 Components of NLP 17


Referential/Anaphoric/Discourse
Ambiguity
• Example: Ali went to Usman. He said, “I am
tired.”
• Exactly who is tired?
• Example: “After they finished the exam the
students and Lecturers left.”
• What can They refer to?

Lecture 02 Components of NLP 18


Referential/Anaphoric/Discourse
Ambiguity

Lecture 02 Components of NLP 19


Pragmatic Ambiguity
• Level of interpretation within its context
• A same word/phrase may be interpreted differently
in two different contexts/situations

Lecture 02 Components of NLP 20


Types of Ambiguity

Lexical

Syntactic Ambiguity Referential

Pragmatic

Lecture 02 Components of NLP 21


Knowledge of Language
• Phonology – concerns how words are related to the sounds
that realize them.

• Morphology – concerns how words are constructed from


more basic meaning units called morphemes. A morpheme
is the primitive unit of meaning in a language.

• Syntax – concerns how can be put together to form correct


sentences and determines what structural role each word
plays in the sentence and what phrases are subparts of
other phrases.

• Semantics – concerns what words mean and how these


meaning combine in sentences to form sentence meaning.
The study of context-independent meaning.
Lecture 02 Components of NLP 22
Knowledge of Language (cont.)
• Pragmatics – concerns how sentences are used in
different situations and how use affects the
interpretation of the sentence.

• Discourse – concerns how the immediately preceding


sentences affect the interpretation of the next
sentence. For example, interpreting pronouns and
interpreting the temporal aspects of the information.

• World Knowledge – includes general knowledge about


the world. What each language user must know about
the other’s beliefs and goals.

Lecture 02 Components of NLP 23


Knowledge of Language
Semantics Vs. Pragmatics
Semantics Pragmatics

Study of words and their meanings in a Study of words and their meanings in
language the language with concern to their
context
Focuses mainly on the significance of Additionally focuses on the meaning of
the meaning of the words in a literal words according to the context and
sense their inferred meanings as well
Studies the literal meaning Studies the intended or inferred
meaning as well

E.g. “Today is Sunday” . Semantically it E.g. “Today is Sunday.” Pragmatically


means today is first day of the week. you can mean a lot by saying this.
Lecture 02 Components of NLP 24
Levels of Language

Lecture 02 Components of NLP 25


Knowledge of Language

Lecture 02 Components of NLP 26


Resolve Ambiguities
• We will introduce models and algorithms to resolve
ambiguities at different levels.
• part-of-speech tagging -- Deciding whether duck is
verb or noun.
• word-sense disambiguation -- Deciding whether make
is create or cook.
• lexical disambiguation -- Resolution of part-of-speech
and word-sense ambiguities are two important
kinds of lexical disambiguation.
• syntactic ambiguity -- her duck is an example of
syntactic ambiguity, and can be addressed by
probabilistic parsing.

Lecture 02 Components of NLP 27


Resolve Ambiguities (cont.)
I made her hen

S S

NP VP NP VP

I V NP NP I V NP

made her hen made DET N

her
hen

Lecture 02 Components of NLP 28

You might also like