0% found this document useful (0 votes)
16 views31 pages

Week 12 Topic 8 NLP

This document provides an introduction to Natural Language Processing (NLP), outlining its definition, phases, levels, techniques, and applications. It explains how NLP enables computers to analyze and understand human language through various stages, such as lexical analysis, syntactic analysis, and semantic analysis. Additionally, it highlights practical applications of NLP, including translation tools, chatbots, and information retrieval.

Uploaded by

fshii2020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views31 pages

Week 12 Topic 8 NLP

This document provides an introduction to Natural Language Processing (NLP), outlining its definition, phases, levels, techniques, and applications. It explains how NLP enables computers to analyze and understand human language through various stages, such as lexical analysis, syntactic analysis, and semantic analysis. Additionally, it highlights practical applications of NLP, including translation tools, chatbots, and information retrieval.

Uploaded by

fshii2020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Topic 8:

Introduction to Natural Processing Language

Term 2-ARTI 106


Computer Track
2024-2025
Learning outcomes

The main learning objectives of this topic are:


 Explain what’s NLP and why to use it.
 Identify the NLP phases and levels.
 Apply all NLP levels in sample sentences and words.
 Explain NLP techniques NLP.
Outlines

 What’s Natural Language Processing?


 Stages of Processing a Sentence.
 NLP levels.
 Phases of NLP.
 NLP techniques
 Applications of NLP.
What is Natural Language Processing
(NLP)

 NLP is 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.
 NLP help machines in understanding human language.
Forms of Natural Language

 The input/output of a NLP system can be:

 written text

 speech

 We will mostly be concerned with written text.


 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.
NLP - an inter-disciplinary Field
Levels of NLP(1)
Natural Language Processing (NLP) operates at multiple levels to process and
understand human language. These levels include:
 Phonological level (speech processing):it study the sound of language . It feeds to
the morphological level the basic sounds which can be combined later.
 Morphological level (word structure): it study the construction and formation of
morphemes. Morphemes are “meaningful units” of combined sounds. It helps to
inform the system how words are constructed. This level will then inform the lexical
level with correct words and variations (i.e. running=run+ing).
 Lexical level (word meaning): it study the meaning of individual words. It will
assign a part of speech (PoS) for each word that makes up a sentence. It outputs to
the syntactic level which will determine a grammatical structure.
NLP levels(2)
 Syntactic level (Grammar & Sentence Structure) : It study the grammar of sentences. This level focuses on
making grammatically correct sentences by arranging the words. It uses rules of syntax to make sentence
structures that follow uniform patterns
 Semantics level (Meaning of Sentences) : It interprets all the meanings of words, phrases, and sentences. It
tries to resolve any ambiguities that may occurs, such as from words with multiple meanings. The syntactic
structure inteprets the meaning and passes it to the semantic level. The semantic level works closely with the
pragmatic level to make sure an appropriate interpretation is made.
 Pragmatics level (Context & Intended Meaning) : This level tries to understand language in its context. It
considers factors like the speaker’s intention and social situations. It builds on the semantic level by using context
and then sends it to the discourse level.
 Discourse level (Beyond Individual Sentences) : it study how the immediately preceding sentences affect the
interpretation of the next sentence. For example, interpreting pronouns and interpreting the temporal aspects of
the information. It connects sentences together to make a logical narrative and then gives it to the world
knowledge level.
Levels in Practice (1)
Level Example Level Example
Phonological Differentiating between Lexical Level: Knowing that “Diamond” can mean
Level: “cut” and “cat” based on “Diamond” and a gemstone and also a shape.
“cat” and “cut” subtle differences in “Diamond” Choosing the correct meaning
sound (phonemes). based on the word alone, often
using dictionaries or word
embeddings.

Morphological Breaking down into “un-” Syntactic Level: Identifying the structure “The cat”
Level: (prefix), “happy” (root), “The cat sat on (subject), “sat” (verb), “on the mat”
“Unhappiness” and “-ness” (suffix). the mat” .This helps in understanding
grammatical relationships.
Pragmatic Level: Understanding that this Semantic Level Recognizing that “blue” here
“Can you pass the isn’t just a question about “I’m feeling blue.” means sad, not the color.
salt?” ability but a polite
request to pass the salt
Levels in Practice (2)

Level Example
Discourse Level: Understanding “She” refers to “Sarah”
Sentence 1: “Sarah went to the market.” and maintaining coherence across
Sentence 2: “She bought some apples.” sentences.
Phases of NLP?

NLP (Natural Language Processing) follows


several phases to process and understand
human language. These phases help transform
raw text or speech into meaningful information
that computers can work with. Here’s a
breakdown of the main phases of NLP:
Lexical Analysis (Tokenization & Morphological Analysis)

Purpose: Breaks text into words, phrases, or meaningful units


(tokens).
Example:
 Input: “Ahmad's car is red."
 Tokenization: [“Ahmad's", "car", "is", "red", "."]
 Lemmatization: “Ahmad's" → “Ahmad" (removing
possession), "is" → "be" (base form of verb).
Syntactic Analysis/parsing
 Purpose: Analyzes the grammatical structure of a sentence. We will focus
on syntax.
 The words are transformed intro structure that shows how the words are
related to each other.
 How do we recognize that a sentence is grammatically correct?
 The cat sat on the mat. OK
 On the sat cat mat. NO.
 Obtain the parse tree to represent groupings. Helps in checking if a sentence
follows correct grammar.
 Example of parsing: Identifies "The cat" (subject), "sat" (verb), and "on the mat"
(prepositional phrase).
Example of parse tree
 When we hear a sentence like “The rat ate cheese,” our brains build a parse
tree similar to the following diagram:
Semantics Analysis

 Purpose: Assign meanings to words and sentences of the


language.
 This stage uses word sense disambiguation (WSD) to
determine meaning based on context.
 Example 1: “colorless blue idea”. This would be rejected by the
analyzer as colorless blue do not make any sense together.
 Example 2: "I’m feeling blue today." Semantic analysis
understands that "blue" means "sad," not the color.
Semantics Analysis
 Unfortunately, many words have several meanings, for example, the word
‘diamond’ might have the following set of meanings:
 a geometrical shape with four equal sides.
 a baseball field
 an extremely hard and valuable gemstone

 To select the correct meaning for the word ‘diamond’ in the sentence:
Salma saw Sarah’s diamond shimmering from across the room.

 It is necessary to know that neither geometrical shapes nor baseball fields


shimmer, whereas gemstones do (process of elimination).
Discourse Integration
(Context Understanding)

 Purpose: Connects meaning across multiple


sentences.
 The meaning of any single sentence depends upon
the sentence that precedes it and also invokes the
meaning of the sentence that follow it.
 For example: the word “she” in the sentence “she
loves reading’ depends upon the prior discourse
context (Sarah bought a book).
Pragmatic Analysis
(Intent & Implication Recognition)

 Purpose: Understands implied meanings and speaker intent.


 Pragmatics concerns the overall communicative and social
context and its effect on interpretation.
 The main focus on what was said is reinterpreted on what it
actually means.
 For example: “ Can you close the window?” should have
been interpreted as a request rather than question.*
 Helps in chatbots, sentiment analysis, and sarcasm
detection.
How to performs NLP?
NLP techniques

NLP relies on various techniques to analyze, understand,


and generate human language.
Segmentation
 You first need to break the entire document down into sentences.
 Sentence segmentation (also called sentence boundary detection) is the process of
dividing a paragraph or text into individual sentences using punctuation.
 The challenge of this technique is that not all periods (.) indicate sentence
boundaries (i.e. "Dr." and "U.S." should not break the sentence).
Tokenizing
 For the algorithm to understand these sentences, you need to get the words in a sentence
and explain them individually to our algorithm.
 So, you break down your sentence into its constituent words and store them. This is called
tokenizing, and each word is called a token.
Removing Stop Words
 You can make the learning process faster by getting rid of non-essential words,
which add little meaning to our statement and are just there to make our
statement sound more cohesive. Words such as was, in, is, and, the, are called
stop words and can be removed.
Stemming
 It is the process of obtaining the Word Stem of a word. Word
Stem gives new words upon adding affixes to them.
Lemmatization
 The process of obtaining the Root Stem of a word. Root Stem gives the new
base form of a word that is present in the dictionary and from which the
word is derived. You can also identify the base words for different words
based on the tense, mood, gender, etc.
Part of Speech (PoS )
Tagging

 Now, you must explain the concept of nouns, verbs, articles, and other parts of
speech to the machine by adding these tags to our words. This is called ‘part of’.
 Identifies each word’s grammatical category (noun, verb, adjective, etc.).
Named Entity Recognition (NER)

 This technique aims to identify predefined categories of objects in a body of


text such as names, dates, locations, medical codes ,organizations, movies.
NER will classify words into subcategories.
 The goal of NER is to automatically extract information from unstructured text
find any keywords in a sentence.
 Example: "Elon Musk founded SpaceX in 2002." Output: [("Elon Musk",
PERSON), ("SpaceX", ORG), ("2002", DATE)]
 After performing the preprocessing steps, you then give your resultant data to
a machine learning algorithm like Naive Bayes, etc., to create your NLP
application.
Applications of NLP
Applications of NLP

Some applications of NLP include :


 Translation Tools: Tools such as Google Translate,
Amazon Translate, etc. translate sentences from one
language to another using NLP.
 Chatbots: Chatbots can be found on most websites and
are a way for companies to deal with common queries
quickly.
Applications of NLP
 Information retrieval & Web Search: Google, Yahoo,
Bing, and other search engines base their machine
translation technology on NLP deep learning models. It
allows algorithms to read text on a webpage, interpret
its meaning and translate it to another language.
 Grammar Correction: NLP technique is widely used by
word processor software like MS-word for spelling
correction & grammar check.
Applications of NLP
 Question Answering: Type in keywords to ask Questions
in Natural Language.
 Text Summarization: The process of summarising
important information from a source to produce a
shortened version.
 Machine Translation: Use of computer applications to
translate text or speech from one natural language to
another.
Thank you for you attention

You might also like