A411 NLP Lect 1 natural language processing

twitchprimegaming112 0 views 58 slides Oct 07, 2025
Slide 1
Slide 1 of 58
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58

About This Presentation

Nlp lec1


Slide Content

AI411: NLP (Natural Language Processing )
Lecture 1: Introduction
Fall 2024
Dr. Ensaf Hussein
Associate Professor, Artificial Intelligence,
School of Information Technology and Computer Science,
Nile University.

In this Course we will learn to:
1.The foundations of the effective modern methods for deep learning
applied to NLP
▪Basics first, then key methods used in NLP: Word vectors, feed-forward
networks, recurrent networks, attention, encoder-decoder models,
transformers, etc.
2.A big picture understanding of human languages and the difficulties in
understanding and producing them via computers
3.An understanding of and ability to build systems for some of the major
problems in NLP:
▪Word meaning, machine translation, summarization, question answering

Prerequisites
▪AIS301: Machine Learning

Tentative Schedule
1 Introduction to NLP
2 NLP Pipeline and Preprocessing
3 Word Embeddings
4 Backpropagation and Neural Networks
5 CFG - Dependency Parsing
6 Recurrent Neural Networks (RNNs) and Language Models
7 Named Entity Recognition (NER) and Part of Speech Tagging
8 Fancy RNNs, Seq2Seq
9 Machine Translation, Attention
10Transformers
11Pretraining Models - QA
12Final Exam Review & Recap

Resources:

Grading policy
•Course Work:
•Lect Quizzes 10%
•Lab Quizzes: 10%
•Assignments: 10%
•Project : 20%
•Midterm: 20%
•Final Exam: 30%
•students with less than 30% in final exam will get an F in the course
• Students should attend 75% of lectures and labs to enter the final exam

Book Structure

Today’s Agenda
•What is NLP?
•History of NLP
• NLP Tasks
–NLU Applications
–NLG Applications
• What Is Language?
– Budling Blocks of language
– Why is Language challenging?
•ML, DL, and NLP: An Overview
•Approaches to NLP
– Heuristics-Based NLP
– Machine Learning for NLP
– Deep Learning for NLP

What is Natural Language Processing (NLP)?
•NLP deals with analyzing, understanding, and generating
human language through computational models.
•While humans communicate using natural language, machines
operate on structured data.
•NLP acts as the intermediary, converting unstructured human
language into structured data that machines can interpret.

History of NLP
2017

History ofNLP
•NLP has been through (at least) 3 majoreras:
▪1950s-1980s: Linguistics Methods and HandwrittenRules
▪1980s-2013: Corpus/StatisticalMethods
▪2013s- Now: DeepLearning
•Lucky you! You’re right near the start of a paradigmshift!

1950s -1980s: Linguistics/RuleSystems
•NLP systems focuson:
▪Linguistics: Grammar rules, sentence structure parsing,etc
▪Handwritten Rules: Huge sets of logical (if/else)statements
▪Ontologies: Manually created (domain-specific!) knowledge
bases to augment rulesabove
•Problems:
▪Too complex tomaintain
▪Can’tscale!
▪Can’tgeneralize!

Eliza: 1966
•ELIZA is a simple pattern-based that uses pattern matching to recognize
phrases like “You are X” and translate them into suitable outputs like “What
makes you think I am X?”.
•ELIZA doesn’t actually need to know anything to mimic a Rogerian
psychotherapist.
•modern conversational agents are much more than a diversion; they can
answer questions, book flights, or find restaurants, functions for which they
rely on a much more sophisticated understanding of the user’s intent.

1980s –2013s: Corpus/StatisticalMethods
•NLP starts using Machine Learningmethods
•Use statistical learning over huge datasets of unstructuredtext
▪Corpus: Collection of textdocuments
▪e.g. Supervised Learning: MachineTranslation
▪e.g. Unsupervised Learning: Deriving Word "Meanings"
(vectors)

2013s-NowDeepLearning
•Deep Learning made its name with Imagesfirst
•2013: Deep Learning has major NLPbreakthroughs
▪Researchers use a neural network to win the Large Scale
Visual Recognition Challenge (LSVRC)
▪This state of the art approach beat other ML approaches with
half theirerror
rate (26% vs16%)
•Very useful for unified processing of Language +Images

The Role of Language in NLP
Language is a complex structure made up of different
components, such as phonemes, morphemes, syntax, and
context. Understanding these components is essential for
building NLP systems that can process and interpret human
language effectively.

Building Blocks of Language and their applications

Phonemes
•The smallest unit of sound in a
language.
•Though they carry no meaning by
themselves, they form the basis
for speech recognition systems.
•For instance, "p" in "pat" and "b"
in "bat" are distinct phonemes in
English.

Morphemes
• The smallest unit of meaning in a
language, often seen as prefixes,
suffixes, or roots.
•For example, in the word
"unbreakable," "un-", "break,"
and "-able" are all morphemes.

Syntax
•The set of rules that govern how
sentences are structured in a
language.
•It dictates how words are combined
to form grammatically correct
sentences.
• Parsing techniques in NLP rely on
syntax to understand sentence
structure.

Context
•Context is crucial in determining the meaning of a sentence,
especially when words have multiple meanings.
•For example, the word "bank" could refer to a financial
institution or the side of a river.
•Context helps resolve such ambiguities.

Levels ofNLP
Morphemes Phonemes
Syntax
Semantics
Discourse
Text
Speech
Early RulesEngines
CorpusMethods
Modern Deep Learning is
abouthere!

NLP: Speech vsText
ConceptSpace
Text Speech
•Natural Language can refer to Text orSpeech
•Goal of both is the same: translate raw data (text or speech) into underlying
concepts (NLU) then possibly into the other form(NLG)
Text toSpeech
Speech toText
NLU
NLG
NLU
NLG

NLP Tasks and Application

NLU Vs. NLG Applications
•ML on Text (Classification, Regression,
Clustering)
•Document Recommendation
•Language Identification
•Natural Language Search
•Sentiment Analysis
•Text Summarization
•Extracting Word/Document Meaning (vectors)
•Relationship Extraction
•Topic Modeling
•…and more!
•Image Captioning
•(Better) Text Summarization
•Machine Translation
•Question Answering/Chatbots
•…so much more
•Notice NLU is almost a prerequisite for NLG

NLU Application
•Document Classification: “documents” -discrete collections of text -into
categories
▪Example: classify movie reviews as positive vs.negative
•Document Recommendation: Choosing the most relevant document based
on some information:
▪Example: show most relevant webpages based on query to search engine
•Topic Modeling: Breaking a set of documents into topics at the word level
▪Example: find documents belonging to a certain topic

NLG: ImageCaptioning
•Automatically generate captions forimages
Captions automaticallygenerated.
Source:https://cs.stanford.edu/people/karpathy/cvpr2015.pdf

NLG: MachineTranslation
Example from Google®’s machine translation system(2016)
Source: https://ai.googleblog.com/2016/09/a-neural-network-for-
machine.html
•Automatically translate text betweenlanguage

NLG: TextSummarization
•Automatically generate text summaries ofdocuments
▪Example: generate headlines of newsarticles
Source: https://ai.googleblog.com/2016/08/text-summarization-with-
tensorflow.html

30
NLG: Question Answering

31
NLG: Question Answering

•figure credit: Phani Marupaka
32
NLG: Dialog Systems

33
determiner verb (past) prep. proper proper poss. adj. noun
Some questioned if Tim Cook ’s first product
modal verb det. adjective noun prep. proper punc.
would be a breakaway hit for Apple .
Part-of-Speech-Tagging

determiner verb (past) prep. proper proper poss. adj. noun

modal verb det. adjective noun prep. proper punc.

34
determiner verb (past) prep. noun noun poss. adj. noun
Some questioned if Tim Cook ’s first product
modal verb det. adjective noun prep. noun punc.
would be a breakaway hit for Apple .
Part-of-Speech-Tagging

35
NP NP
Cook ’s first product may not be a breakaway hit
Syntactic Parsing

36
NP NP
VP
Cook ’s first product may not be a breakaway hit
Syntactic Parsing

37
NP NP
VP
Cook ’s first product may not be a breakaway hit
SSyntactic Parsing

38
Some questioned if Tim Cook’s first product would be a breakaway hit for Apple.
PERSON ORGANIZATION
Named Entity Recognition

39
Some questioned if Tim Cook’s first product would be a breakaway hit for Apple.
Entity Linking

40
Some questioned if Tim Cook’s first product would be a
breakaway hit for Apple.
It’s the company’s first new device since he became CEO.
Coreference Resolution

41
Some questioned if Tim Cook’s first product
would be a breakaway hit for Apple.
It’s the company’s first new device since he
became CEO.
Coreference Resolution

42
Some questioned if Tim Cook’s first product
would be a breakaway hit for Apple.
It’s the company’s first new device since he
became CEO.
Coreference Resolution

43
Some questioned if Tim Cook’s first product
would be a breakaway hit for Apple.
It’s the company’s first new device since he
became CEO.
??
Coreference Resolution

•Once there was a boy named Fritz who loved to draw. He drew everything.
In the morning, he drew a picture of his cereal with milk. His papa said,
“Don’t draw your cereal. Eat it!”
•After school, Fritz drew a picture of his bicycle. His uncle said, “Don't draw
your bicycle. Ride it!”
•…
•What did Fritz draw first?
• A) the toothpaste
• B) his mama
• C) cereal and milk
• D) his bicycle
44
Reading Comprehension

45
Reading Comprehension

46
Other ways are needed.
We must find other ways.
I absolutely do believe there was an iceberg in those waters.
I don't believe there was any iceberg at all anywhere near the Titanic.
4.4
1.2
Input Output
Pakistan bomb victims’ families end protest
Pakistan bomb victims to be buried after protest ends
2.6
Sentence Similarity

47
he bent down and searched the large container, trying to find
anything else hidden in it other than the _____
Word Prediction

48
he turned to one of the cops beside him. “search the entire
coffin.” the man nodded and bustled forward towards the coffin.
he bent down and searched the large container, trying to find
anything else hidden in it other than the _____
Word Prediction

Language Models
•A model like the one in the previous examples is called
language model.
•A language model is trained on a huge amount of texts, trying
to learn the distribution of the words in the language.
•This can be done by training the model to predict the words
that follow a sentence, or trying to recover masked words from
their surrounding context.

GPT3
•This model is a transformer neural network consisting of 175
billions of parameters and requiring approximately 800GB of
storage.
•The training data consists of hundreds of billions of words from
texts from around the Internet. It has been trained by OpenAI,
which hosts it and make it available as a service.

NLP Tasks organized according to their difficulty

Challenges in NLP
Despite NLP’s success, the field is fraught with several challenges due
to the inherent complexity of human language:
1. Ambiguity
Human language is inherently ambiguous. A single sentence can have
multiple meanings depending on the context.
For example, “I made her duck” could mean either preparing a meal or causing
someone to crouch.
2. Common Knowledge
Humans use common knowledge—unstated facts and assumptions—
in conversations. Machines, however, struggle to understand this
unless explicitly programmed.

Examples on ambiguity in Language

Challenges in NLP
3. Creativity
Language often includes metaphors, idioms, and sarcasm,
making it difficult for machines to interpret literal versus
figurative meanings.
4. Diversity of Languages
The grammatical and syntactical rules of languages vary greatly,
making it challenging to create universal NLP systems.

Machine Learning, Deep Learning, and NLP: An Overview
•NLP has evolved from heuristic, rule-based systems to approaches
leveraging machine learning (ML) and deep learning (DL).
•Early approaches focused on hand-crafted rules, but ML models,
such as Naive Bayes and SVMs, now dominate.

•Deep learning, especially with architectures like RNNs, LSTMs,
CNNs, and Transformers (e.g., BERT), has significantly enhanced
NLP capabilities.

How NLP, ML, and DL are related

Approaches to NLP
There are three main approaches:
•Heuristics-Based NLP: Early systems based on rules and domain-specific
knowledge (e.g., lexicons, regex).
•Machine Learning for NLP: Supervised and unsupervised learning
techniques, such as Naive Bayes, SVMs, and HMMs, have been applied
to NLP tasks.
•Deep Learning for NLP: Advanced models like LSTMs and Transformers
dominate the field but still face challenges like overfitting, domain
adaptation, and interpretability.

Wrapping Up …
•What is NLP?
•History of NLP
• NLP Tasks
–NLU Applications
–NLG Applications
• What Is Language?
– Budling Blocks of language
– Why is Language challenging?
•ML, DL, and NLP: An Overview
•Approaches to NLP
– Heuristics-Based NLP
– Machine Learning for NLP
– Deep Learning for NLP