Lecture 4 - NNLS
Lecture 4 - NNLS
2024/2023
What is Natural Language Processing (NLP)
• The process of computer analysis of input provided in a human
language (natural language), and conversion of this input into a useful
form of representation.
• The field of NLP is primarily concerned with getting computers to
perform useful and interesting tasks with human languages.
• The field of NLP is secondarily concerned with helping us come to a
better understanding of human language.
2
Forms of Natural Language
• The input/output of a NLP system can be:
• written text
• speech
• We will mostly concerned with written text (not speech).
• To process written text, we need:
• lexical, syntactic, semantic knowledge about the language
• discourse information, real world knowledge
• To process spoken language, we need everything required to process
written text, plus the challenges of speech recognition and speech
synthesis.
3
4
Components of NLP
• Natural Language Understanding
• Mapping the given input in the natural language into a useful representation.
• Different level of analysis required:
morphological analysis,
syntactic analysis,
semantic analysis,
discourse analysis, …
• Natural Language Generation
• Producing output in the natural language from some internal representation.
• Different level of synthesis required:
deep planning (what to say),
syntactic generation
• NL Understanding is much harder than NL Generation.
But, still both of them are hard.
8
Why is NLP hard?
• Reason (1) – human language is ambiguous.
17
Ambiguity
• “Get the cat with the gloves.”
18
Ambiguity
• “Get the cat with the gloves.”
19
20
Knowledge of Language
• Phonology – concerns how words are related to the sounds that realize
them.
22
Phonology
•Red and Read
•Flower and Flour
•I and Eye
•Write and Right
•Knows and Nose
•Hear and Here
•Weight and Wait
•A part and Apart
•Piece and Peace
•ate and eight
23
What is Morphology?
24
Morphology for NLP
25
Morphemes
• Smallest meaning bearing units constituting a word
26
Inflection vs Derivation morphemes
• Inflection is the morphological system for making word forms of
words,
• derivation is one of the morphological systems for making new
words.
• Derivation is formally similar to inflection because both processes
make use of affixation.
27
Inflectional morphemes:
• Create new forms of the same word with the addition of grammatical
properties. The basic meaning and the category is the same.
• - s (plural) Number
• - ‘s (possessive) Possessive
• - ed (past tense)
• - ing (progressive) Tense
• - er (comparison)
• - est (superlative) Comparison
28
Derivational morphemes:
• Creating new words (with the addition of affixes) with a different
meaning that may belong to a different grammatical category.
• Write (V) re- + write rewrite (V)
• Write (V) writ + -er writer (N)
•V N
•N ADJ.
•N V
•N N
29
Inflection vs Derivation morphemes
30
Ambiguity
I made her duck.
32
Ambiguity is Everywhere
• Lexical category: part of speech
‣ Duck can be a Noun or Verb
• V: Duck! I caused her to quickly lower her head or body.
• N: I cooked waterfowl for her benefit
‣ Her can be possessive (of her) or dative (for her)
• Possessive: I cooked waterfowl belonging to her.
• Dative: I cooked waterfowl for her benefit
• Lexical Semantics:
‣ Make can mean create or cook
• create: I made the (plaster) duck statue she owns
• cook: I cooked waterfowl for her benefit
Ambiguity (cont.)
• Some interpretations of : I made her duck.
1. I cooked duck for her.
2. I cooked duck belonging to her.
3. I created a toy duck which she owns.
4. I caused her to quickly lower her head or body.
5. I used magic and turned her into a duck.
• duck – morphologically and syntactically ambiguous:
noun or verb.
• her – syntactically ambiguous: dative or possessive.
• make – semantically ambiguous: cook or create.
• make – syntactically ambiguous:
• Transitive – takes a direct object.
• Di-transitive – takes two objects.
• Takes a direct object and a verb.
34
Ambiguity (cont.)
• Grammar: Make can be:
‣ Transitive: (verb has a noun direct object)
• I cooked [waterfowl belonging to her]
35
Ambiguity (cont.)
• Some interpretations of : I made her duck.
1. I cooked duck for her.
2. I cooked duck belonging to her.
3. I created a toy duck which she owns.
4. I caused her to quickly lower her head or body.
5. I used magic and turned her into a duck.
• duck – morphologically and syntactically ambiguous:
noun or verb.
• her – syntactically ambiguous: dative or possessive.
• make – semantically ambiguous: cook or create.
• make – syntactically ambiguous:
• Transitive – takes a direct object. => 2
• Di-transitive – takes two objects. => 5
• Takes a direct object and a verb. => 4
36
Syntactic Ambiguity
• Structural ambiguity: one sentence can have many syntactic
representations
Another Ambiguity to “I made her duck” is
phonetics
38
Word2vec Architecture
• There are two architectures used by Word2vec:
• The objective is to turn each document of free text into a vector that we
can use as input or output for a machine learning model.