SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Artificial Intelligence
Natural Language Processing:
Parsing

Rushdi Shams
Computational Linguistics Lab
Western University.
rshams@uwo.ca
Natural Language
• Natural Language means any language we
speak
• We need to process natural language (in
text, speech, etc.) so that machine can
exploit it.
• Applications: numerous!
– Watson (Jeopardy)
– MS Word
Parsing
• The first task for any NLP-based system is to
read (or to parse) the text
• Parsing depends on three components of a
language1. Lexicon
2. Categorization
3. Grammar Rules
Lexicon
stench | breeze | glitter | nothing | wumpus | pit | pits | gold | east | ..
is | see | smell | shoot | feel | stinks | go | grab | carry | kill | turn | …
right | left | east | south | back | smelly | …
here | there | nearby | ahead | right | left | east | south | back | …
me | you | I | it | S=HE | Y’ALL …
John | Mary | Boston | UCB | PAJC | …
the | a | an | …
to | in | on | near | …
and | or | but | …

0|1|2|3|4|5|6|7|8|9

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

4
Categorization
Noun > stench | breeze | glitter | nothing | wumpus | pit | pits | gold | east | ..
Verb > is | see | smell | shoot | feel | stinks | go | grab | carry | kill | turn | …
Adjective > right | left | east | south | back | smelly | …
Adverb > here | there | nearby | ahead | right | left | east | south | back | …
Pronoun > me | you | I | it | S=HE | Y’ALL …
Name > John | Mary | Boston | UCB | PAJC | …
Article > the | a | an | …
Preposition > to | in | on | near | …
Conjunction > and | or | but | …

Digit > 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

5
Grammar Rules
• “The large cat”
• This phrase can be parsed by an NLP-system if
it has a grammar like
Noun Phrase -> Determiner + Adjective + Noun

• If your system finds a phrase or sentence that
has a pattern not mentioned in its set of
Grammar Rules it won’t be able to parse
them.
Therefore...
• Parsing is the process of using grammar
rules to determine whether a sentence is
legal,
• and to obtain its Syntactic Tree

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

7
Syntactic Tree
‘The large cat eats the small rat’

http://www.digitalenema.com/2012_07_01_archive.html
Syntactic Tree

The

large

cat

eats

the

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

small

rat

9
Syntactic Tree

Article adjective noun

Verb
Article adjective noun

The

large

cat

eats

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

the

small

rat

10
Syntactic Tree

Article adjective noun

Verb

noun phrase
Article adjective noun

The

large

cat

eats

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

the

small

rat

11
Syntactic Tree
Noun phrase

Article adjective noun

Verb

noun phrase
Article adjective noun

The

large

cat

eats

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

the

small

rat

12
Syntactic Tree
Noun phrase

verb phrase

Article adjective noun

Verb

noun phrase
Article adjective noun

The

large

cat

eats

the

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

small

rat

13
Syntactic Tree
sentence

Noun phrase

verb phrase

Article adjective noun

Verb

noun phrase
Article adjective noun

The

large

cat

eats

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

the

small

rat

14
Label Bracketing
• It is a process of representing the syntactic tree in another way.

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

15
Do yourself: Label Bracket the tree

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

16
Evaluation of Parsing
• The two most frequent and basic measures to
evaluate parsing:

17
Precision, Recall, and F1-Score
• The notions are much clearer with a
contingency table-

18
Evaluation of Parsing
However…

http://www.cafepress.com/barrysworld/1486105
And…
Ambiguity
• There are 2 types of ambiguity1. Lexical Ambiguity: Sentence contains an
idiom/word/term that has more than one
meaning.
Glasses means both drinking glasses and
spectacles

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

24
Ambiguity
2. Structural Ambiguity: Sentence has more
than one syntactic tree
I saw the boy with the telescope

Did you see the boy with a telescope? Or
Did you see the boy who was having a
telescope?
Rushdi Shams, Dept of CSE, KUET,
Bangladesh

25
Structural Ambiguity

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

26
Ambiguity
• Which of the following examples have
lexical ambiguity and which of them carry
structural ambiguity; justify1. The painter put on another coat
2. We like flying planes
3. Visiting relatives can be tiresome

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

27
Ambiguity
• He wrote the note yesterday
• You mean you carried the information by a
bus?
• Connecting wires are tiring in electronics lab
• Squad helps dog bite victim

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

28
Word Sense
• Most of the lexical ambiguity arises from the
differences in word sense.
• Word senses vary due to several factors:
– Synonymy
– Antonymy
– Homonymy
– Polysemy and
– Heteronymy
Synonymy
• Synonyms are different words (or sometimes
phrases) with identical or very similar
meanings.
• Words that are synonyms are said to
be synonymous, and the state of being a
synonym is called synonymy

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

30
Synonymy
•
•
•
•
•

student and pupil (noun)
buy and purchase (verb)
sick and ill (adjective)
quickly and speedily (adverb)
on and upon (preposition)

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

31
Synonymy is a relation between senses
rather than words
• Note that synonyms are defined with respect
to certain senses of words
• pupil as the "aperture in the iris of the eye" is
not synonymous with student.
• Similarly, he expired means the same as he
died, yet my passport has expired cannot be
replaced by my passport has died.

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

32
Synonymy is a relation between senses
rather than words
• Consider the words big and large
• Are they synonyms?:
– How big is the plane?
– Are we travelling with a large or small plane?

• How about?:
– Mrs Benjamin became a big sister of him
– Mrs Benjamin became a large sister of him
Heteronymy
• heteronyms (also known as heterophones)
are words with
– identical spellings (or characters)
– but different pronunciations and meanings.

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

34
Antonymy
• Antonyms are words with opposite or nearly
opposite meanings.
• short and tall
• dead and alive
• increase and decrease

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

35
Homonymy
• A homonym is one of a group of words that
– share the same spelling but
– Have different distinct meaning
• Bank (Financial Institute) vs Bank (Sloping Land)
• Bat (A club for hitting the ball) vs Bat (Mammal)

• Homographs (Bank/Bank, Bat/Bat)
• Homophones (Right/Write, Piece/Peace)

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

36
Polysemy
• Homonymous words that are related with
each other
– The bank was constructed in 1971 (building
related to a financial institute)
– I draw money from the bank (financial institute)
Hypernymy and Hyponymy
• Superclass-subclass structure
– Car is a hypernym of Honda
– Honda is a hyponym of Car
Zeugma Test
• A test to see whether or not two words have
the same sense
– Which flight does serve breakfast?
– Does Lufthansa serve Philadelphia?

• Simply make a conjunction:
– Does Lufthansa serve breakfast and Philadelphia?
WordNet 3.0
• A hierarchically organized lexical database
• On-line thesaurus + aspects of a dictionary
• Some other languages available or under development
– (Arabic, Finnish, German, Portuguese…)

Category

Unique Strings

Noun

117,798

Verb

11,529

Adjective

22,479

Adverb

4,481
Senses of “bass” in Wordnet
WordNet Hypernym Hierarchy for
“bass”
WordNet Noun Relations
WordNet 3.0
• Where it is:
– http://wordnetweb.princeton.edu/perl/webwn

• Libraries
– Python: WordNet from NLTK
• http://www.nltk.org/Home
– Java:
• JWNL, extJWNL on sourceforge
Difficulties with Natural Language:
Anaphora
• Using pronouns to refer back to entities already
introduced in the text
– After Mary proposed to John, they found a preacher
and got married. For the honeymoon, they went to
Hawaii
– Mary saw a ring through the window and asked John
for it
– Mary threw a rock at the window and broke it

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

45
Difficulties with Natural Language:
Indexicality
• Indexical sentences refer to utterance
situation (place, time, etc.)
– I am over here
– Why did you do that?

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

46
Difficulties with Natural Language:
Metonymy
• Using one noun phrase to stand for another
– I've read Shakespeare
– Chrysler announced record profits
– The ham sandwich on Table 4 wants another
beer

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

47
Difficulties with Natural Language:
Metaphor
• “Non-literal" usage of words and phrases,
often systematic.
– I've tried killing the process but it won't die. Its
parent keeps it alive.

Rushdi Shams, Dept of CSE, KUET,
Bangladesh

48
Summary
• The components of a language
– Lexicon
– Categorization
– Grammar rules

•
•
•
•
•

Syntactic Tree
Label Bracketing
Evaluation of Parsing
Word sense
Problem of Parsing

Weitere ähnliche Inhalte

Was ist angesagt?

Lecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfLecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfDeptii Chaudhari
 
Knowledge representation in AI
Knowledge representation in AIKnowledge representation in AI
Knowledge representation in AIVishal Singh
 
Introduction to Natural Language Processing
Introduction to Natural Language ProcessingIntroduction to Natural Language Processing
Introduction to Natural Language Processingrohitnayak
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prologHarry Potter
 
Natural language processing
Natural language processingNatural language processing
Natural language processingHansi Thenuwara
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingYasir Khan
 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measuresankit_ppt
 
Natural language processing
Natural language processingNatural language processing
Natural language processingYogendra Tamang
 
Natural Language Processing with Python
Natural Language Processing with PythonNatural Language Processing with Python
Natural Language Processing with PythonBenjamin Bengfort
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingSaurabh Kaushik
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemMohammad Imam Hossain
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesDr. C.V. Suresh Babu
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & ReasoningSajid Marwat
 

Was ist angesagt? (20)

Natural language processing
Natural language processingNatural language processing
Natural language processing
 
Language models
Language modelsLanguage models
Language models
 
Lecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfLecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdf
 
NLP
NLPNLP
NLP
 
Knowledge representation in AI
Knowledge representation in AIKnowledge representation in AI
Knowledge representation in AI
 
Introduction to Natural Language Processing
Introduction to Natural Language ProcessingIntroduction to Natural Language Processing
Introduction to Natural Language Processing
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prolog
 
Natural language processing
Natural language processingNatural language processing
Natural language processing
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Reasoning in AI
Reasoning in AIReasoning in AI
Reasoning in AI
 
NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measures
 
Natural language processing
Natural language processingNatural language processing
Natural language processing
 
Natural Language Processing with Python
Natural Language Processing with PythonNatural Language Processing with Python
Natural Language Processing with Python
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction Problem
 
Nlp
NlpNlp
Nlp
 
Machine translation
Machine translationMachine translation
Machine translation
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching Techniques
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
 

Andere mochten auch

Artificial Intelligence: Use of AI and Natural Language Processing to effecti...
Artificial Intelligence: Use of AI and Natural Language Processing to effecti...Artificial Intelligence: Use of AI and Natural Language Processing to effecti...
Artificial Intelligence: Use of AI and Natural Language Processing to effecti...White Clarke Group
 
From Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial IntelligenceFrom Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial IntelligenceJonathan Mugan
 
Semi-supervised classification for natural language processing
Semi-supervised classification for natural language processingSemi-supervised classification for natural language processing
Semi-supervised classification for natural language processingRushdi Shams
 
Types of machine translation
Types of machine translationTypes of machine translation
Types of machine translationRushdi Shams
 
Natural language processing (NLP) introduction
Natural language processing (NLP) introductionNatural language processing (NLP) introduction
Natural language processing (NLP) introductionRobert Lujo
 
Dependency Parsing
Dependency ParsingDependency Parsing
Dependency ParsingJinho Choi
 
Text Analytics for Semantic Computing
Text Analytics for Semantic ComputingText Analytics for Semantic Computing
Text Analytics for Semantic ComputingMeena Nagarajan
 
L1 l2 l3 introduction to machine translation
L1 l2 l3  introduction to machine translationL1 l2 l3  introduction to machine translation
L1 l2 l3 introduction to machine translationRushdi Shams
 
Probabilistic logic
Probabilistic logicProbabilistic logic
Probabilistic logicRushdi Shams
 
Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing Mustafa Jarrar
 
Jarrar: Description Logic
Jarrar: Description LogicJarrar: Description Logic
Jarrar: Description LogicMustafa Jarrar
 
L13 why software fails
L13  why software failsL13  why software fails
L13 why software failsRushdi Shams
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representationRushdi Shams
 
L1 overview of software engineering
L1  overview of software engineeringL1  overview of software engineering
L1 overview of software engineeringRushdi Shams
 
Lecture 5, 6 and 7 cpu scheduling
Lecture 5, 6 and 7  cpu schedulingLecture 5, 6 and 7  cpu scheduling
Lecture 5, 6 and 7 cpu schedulingRushdi Shams
 

Andere mochten auch (20)

Artificial Intelligence: Use of AI and Natural Language Processing to effecti...
Artificial Intelligence: Use of AI and Natural Language Processing to effecti...Artificial Intelligence: Use of AI and Natural Language Processing to effecti...
Artificial Intelligence: Use of AI and Natural Language Processing to effecti...
 
From Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial IntelligenceFrom Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial Intelligence
 
L15 fuzzy logic
L15  fuzzy logicL15  fuzzy logic
L15 fuzzy logic
 
Semi-supervised classification for natural language processing
Semi-supervised classification for natural language processingSemi-supervised classification for natural language processing
Semi-supervised classification for natural language processing
 
Linguistics5
Linguistics5         Linguistics5
Linguistics5
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Parsing
ParsingParsing
Parsing
 
Types of machine translation
Types of machine translationTypes of machine translation
Types of machine translation
 
Natural language processing (NLP) introduction
Natural language processing (NLP) introductionNatural language processing (NLP) introduction
Natural language processing (NLP) introduction
 
L4 vpn
L4  vpnL4  vpn
L4 vpn
 
Dependency Parsing
Dependency ParsingDependency Parsing
Dependency Parsing
 
Text Analytics for Semantic Computing
Text Analytics for Semantic ComputingText Analytics for Semantic Computing
Text Analytics for Semantic Computing
 
L1 l2 l3 introduction to machine translation
L1 l2 l3  introduction to machine translationL1 l2 l3  introduction to machine translation
L1 l2 l3 introduction to machine translation
 
Probabilistic logic
Probabilistic logicProbabilistic logic
Probabilistic logic
 
Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing
 
Jarrar: Description Logic
Jarrar: Description LogicJarrar: Description Logic
Jarrar: Description Logic
 
L13 why software fails
L13  why software failsL13  why software fails
L13 why software fails
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
L1 overview of software engineering
L1  overview of software engineeringL1  overview of software engineering
L1 overview of software engineering
 
Lecture 5, 6 and 7 cpu scheduling
Lecture 5, 6 and 7  cpu schedulingLecture 5, 6 and 7  cpu scheduling
Lecture 5, 6 and 7 cpu scheduling
 

Ähnlich wie Parsing in NLP Explained

Syntax and semantics
Syntax and semanticsSyntax and semantics
Syntax and semanticsRushdi Shams
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingToine Bogers
 
Sneha Rajana - Deep Learning Architectures for Semantic Relation Detection Tasks
Sneha Rajana - Deep Learning Architectures for Semantic Relation Detection TasksSneha Rajana - Deep Learning Architectures for Semantic Relation Detection Tasks
Sneha Rajana - Deep Learning Architectures for Semantic Relation Detection TasksMLconf
 
Sanskrit in Natural Language Processing
Sanskrit in Natural Language ProcessingSanskrit in Natural Language Processing
Sanskrit in Natural Language ProcessingHitesh Joshi
 
1. level of language study.pptx
1. level of language study.pptx1. level of language study.pptx
1. level of language study.pptxAlkadumiHamletto
 
Coaching kippsters to guided reading success
Coaching kippsters to guided reading successCoaching kippsters to guided reading success
Coaching kippsters to guided reading successbvardiman
 
Sat lessons power point dt6 10.05.2011
Sat lessons power point dt6 10.05.2011Sat lessons power point dt6 10.05.2011
Sat lessons power point dt6 10.05.2011VJN_88_
 
Patrick Hanks - Why lexicographers should take more notice of phraseology, co...
Patrick Hanks - Why lexicographers should take more notice of phraseology, co...Patrick Hanks - Why lexicographers should take more notice of phraseology, co...
Patrick Hanks - Why lexicographers should take more notice of phraseology, co...Scottish Language Dictionaries
 
Relationship of Descriptive Linguistics in the following areas [Autosaved].pptx
Relationship of Descriptive Linguistics in the following areas [Autosaved].pptxRelationship of Descriptive Linguistics in the following areas [Autosaved].pptx
Relationship of Descriptive Linguistics in the following areas [Autosaved].pptxEnKhi1
 
R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3Rachel Hawkes
 
R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3Rachel Hawkes
 
Hpai class 17 - language - 041420
Hpai   class 17 - language - 041420Hpai   class 17 - language - 041420
Hpai class 17 - language - 041420melendez321
 

Ähnlich wie Parsing in NLP Explained (20)

Syntax and semantics
Syntax and semanticsSyntax and semantics
Syntax and semantics
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Sneha Rajana - Deep Learning Architectures for Semantic Relation Detection Tasks
Sneha Rajana - Deep Learning Architectures for Semantic Relation Detection TasksSneha Rajana - Deep Learning Architectures for Semantic Relation Detection Tasks
Sneha Rajana - Deep Learning Architectures for Semantic Relation Detection Tasks
 
Sanskrit in Natural Language Processing
Sanskrit in Natural Language ProcessingSanskrit in Natural Language Processing
Sanskrit in Natural Language Processing
 
1. level of language study.pptx
1. level of language study.pptx1. level of language study.pptx
1. level of language study.pptx
 
Minimalism
MinimalismMinimalism
Minimalism
 
Coaching kippsters to guided reading success
Coaching kippsters to guided reading successCoaching kippsters to guided reading success
Coaching kippsters to guided reading success
 
Morphology
Morphology Morphology
Morphology
 
Minimalism
MinimalismMinimalism
Minimalism
 
Pragmatics
PragmaticsPragmatics
Pragmatics
 
Sat lessons power point dt6 10.05.2011
Sat lessons power point dt6 10.05.2011Sat lessons power point dt6 10.05.2011
Sat lessons power point dt6 10.05.2011
 
syntax.ppt.pdf
syntax.ppt.pdfsyntax.ppt.pdf
syntax.ppt.pdf
 
PoP wk 9
PoP wk 9PoP wk 9
PoP wk 9
 
Patrick Hanks - Why lexicographers should take more notice of phraseology, co...
Patrick Hanks - Why lexicographers should take more notice of phraseology, co...Patrick Hanks - Why lexicographers should take more notice of phraseology, co...
Patrick Hanks - Why lexicographers should take more notice of phraseology, co...
 
Relationship of Descriptive Linguistics in the following areas [Autosaved].pptx
Relationship of Descriptive Linguistics in the following areas [Autosaved].pptxRelationship of Descriptive Linguistics in the following areas [Autosaved].pptx
Relationship of Descriptive Linguistics in the following areas [Autosaved].pptx
 
R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3
 
R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3R hawkes cheney_school_session1_planning ks3
R hawkes cheney_school_session1_planning ks3
 
Vocabulary i
Vocabulary iVocabulary i
Vocabulary i
 
Hpai class 17 - language - 041420
Hpai   class 17 - language - 041420Hpai   class 17 - language - 041420
Hpai class 17 - language - 041420
 
Syntax
SyntaxSyntax
Syntax
 

Mehr von Rushdi Shams

Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchRushdi Shams
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IRRushdi Shams
 
Machine learning with nlp 101
Machine learning with nlp 101Machine learning with nlp 101
Machine learning with nlp 101Rushdi Shams
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 
Knowledge structure
Knowledge structureKnowledge structure
Knowledge structureRushdi Shams
 
L5 understanding hacking
L5  understanding hackingL5  understanding hacking
L5 understanding hackingRushdi Shams
 
L2 Intrusion Detection System (IDS)
L2  Intrusion Detection System (IDS)L2  Intrusion Detection System (IDS)
L2 Intrusion Detection System (IDS)Rushdi Shams
 
L2 l3 l4 software process models
L2 l3 l4  software process modelsL2 l3 l4  software process models
L2 l3 l4 software process modelsRushdi Shams
 
Lecture 14,15 and 16 file systems
Lecture 14,15 and 16  file systemsLecture 14,15 and 16  file systems
Lecture 14,15 and 16 file systemsRushdi Shams
 
Lecture 11,12 and 13 deadlocks
Lecture 11,12 and 13  deadlocksLecture 11,12 and 13  deadlocks
Lecture 11,12 and 13 deadlocksRushdi Shams
 
Lecture 7, 8, 9 and 10 Inter Process Communication (IPC) in Operating Systems
Lecture 7, 8, 9 and 10  Inter Process Communication (IPC) in Operating SystemsLecture 7, 8, 9 and 10  Inter Process Communication (IPC) in Operating Systems
Lecture 7, 8, 9 and 10 Inter Process Communication (IPC) in Operating SystemsRushdi Shams
 
Lecture 1 and 2 processes
Lecture 1 and 2  processesLecture 1 and 2  processes
Lecture 1 and 2 processesRushdi Shams
 
Lecture 3 and 4 threads
Lecture 3 and 4  threadsLecture 3 and 4  threads
Lecture 3 and 4 threadsRushdi Shams
 
Distributed Database Management Systems (Distributed DBMS)
Distributed Database Management Systems (Distributed DBMS)Distributed Database Management Systems (Distributed DBMS)
Distributed Database Management Systems (Distributed DBMS)Rushdi Shams
 
My slide relational algebra
My slide  relational algebraMy slide  relational algebra
My slide relational algebraRushdi Shams
 

Mehr von Rushdi Shams (19)

Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better Research
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IR
 
Machine learning with nlp 101
Machine learning with nlp 101Machine learning with nlp 101
Machine learning with nlp 101
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Knowledge structure
Knowledge structureKnowledge structure
Knowledge structure
 
First order logic
First order logicFirst order logic
First order logic
 
Belief function
Belief functionBelief function
Belief function
 
L5 understanding hacking
L5  understanding hackingL5  understanding hacking
L5 understanding hacking
 
L3 defense
L3  defenseL3  defense
L3 defense
 
L2 Intrusion Detection System (IDS)
L2  Intrusion Detection System (IDS)L2  Intrusion Detection System (IDS)
L2 Intrusion Detection System (IDS)
 
L1 phishing
L1  phishingL1  phishing
L1 phishing
 
L2 l3 l4 software process models
L2 l3 l4  software process modelsL2 l3 l4  software process models
L2 l3 l4 software process models
 
Lecture 14,15 and 16 file systems
Lecture 14,15 and 16  file systemsLecture 14,15 and 16  file systems
Lecture 14,15 and 16 file systems
 
Lecture 11,12 and 13 deadlocks
Lecture 11,12 and 13  deadlocksLecture 11,12 and 13  deadlocks
Lecture 11,12 and 13 deadlocks
 
Lecture 7, 8, 9 and 10 Inter Process Communication (IPC) in Operating Systems
Lecture 7, 8, 9 and 10  Inter Process Communication (IPC) in Operating SystemsLecture 7, 8, 9 and 10  Inter Process Communication (IPC) in Operating Systems
Lecture 7, 8, 9 and 10 Inter Process Communication (IPC) in Operating Systems
 
Lecture 1 and 2 processes
Lecture 1 and 2  processesLecture 1 and 2  processes
Lecture 1 and 2 processes
 
Lecture 3 and 4 threads
Lecture 3 and 4  threadsLecture 3 and 4  threads
Lecture 3 and 4 threads
 
Distributed Database Management Systems (Distributed DBMS)
Distributed Database Management Systems (Distributed DBMS)Distributed Database Management Systems (Distributed DBMS)
Distributed Database Management Systems (Distributed DBMS)
 
My slide relational algebra
My slide  relational algebraMy slide  relational algebra
My slide relational algebra
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 

Kürzlich hochgeladen (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

Parsing in NLP Explained

  • 1. Artificial Intelligence Natural Language Processing: Parsing Rushdi Shams Computational Linguistics Lab Western University. rshams@uwo.ca
  • 2. Natural Language • Natural Language means any language we speak • We need to process natural language (in text, speech, etc.) so that machine can exploit it. • Applications: numerous! – Watson (Jeopardy) – MS Word
  • 3. Parsing • The first task for any NLP-based system is to read (or to parse) the text • Parsing depends on three components of a language1. Lexicon 2. Categorization 3. Grammar Rules
  • 4. Lexicon stench | breeze | glitter | nothing | wumpus | pit | pits | gold | east | .. is | see | smell | shoot | feel | stinks | go | grab | carry | kill | turn | … right | left | east | south | back | smelly | … here | there | nearby | ahead | right | left | east | south | back | … me | you | I | it | S=HE | Y’ALL … John | Mary | Boston | UCB | PAJC | … the | a | an | … to | in | on | near | … and | or | but | … 0|1|2|3|4|5|6|7|8|9 Rushdi Shams, Dept of CSE, KUET, Bangladesh 4
  • 5. Categorization Noun > stench | breeze | glitter | nothing | wumpus | pit | pits | gold | east | .. Verb > is | see | smell | shoot | feel | stinks | go | grab | carry | kill | turn | … Adjective > right | left | east | south | back | smelly | … Adverb > here | there | nearby | ahead | right | left | east | south | back | … Pronoun > me | you | I | it | S=HE | Y’ALL … Name > John | Mary | Boston | UCB | PAJC | … Article > the | a | an | … Preposition > to | in | on | near | … Conjunction > and | or | but | … Digit > 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Rushdi Shams, Dept of CSE, KUET, Bangladesh 5
  • 6. Grammar Rules • “The large cat” • This phrase can be parsed by an NLP-system if it has a grammar like Noun Phrase -> Determiner + Adjective + Noun • If your system finds a phrase or sentence that has a pattern not mentioned in its set of Grammar Rules it won’t be able to parse them.
  • 7. Therefore... • Parsing is the process of using grammar rules to determine whether a sentence is legal, • and to obtain its Syntactic Tree Rushdi Shams, Dept of CSE, KUET, Bangladesh 7
  • 8. Syntactic Tree ‘The large cat eats the small rat’ http://www.digitalenema.com/2012_07_01_archive.html
  • 9. Syntactic Tree The large cat eats the Rushdi Shams, Dept of CSE, KUET, Bangladesh small rat 9
  • 10. Syntactic Tree Article adjective noun Verb Article adjective noun The large cat eats Rushdi Shams, Dept of CSE, KUET, Bangladesh the small rat 10
  • 11. Syntactic Tree Article adjective noun Verb noun phrase Article adjective noun The large cat eats Rushdi Shams, Dept of CSE, KUET, Bangladesh the small rat 11
  • 12. Syntactic Tree Noun phrase Article adjective noun Verb noun phrase Article adjective noun The large cat eats Rushdi Shams, Dept of CSE, KUET, Bangladesh the small rat 12
  • 13. Syntactic Tree Noun phrase verb phrase Article adjective noun Verb noun phrase Article adjective noun The large cat eats the Rushdi Shams, Dept of CSE, KUET, Bangladesh small rat 13
  • 14. Syntactic Tree sentence Noun phrase verb phrase Article adjective noun Verb noun phrase Article adjective noun The large cat eats Rushdi Shams, Dept of CSE, KUET, Bangladesh the small rat 14
  • 15. Label Bracketing • It is a process of representing the syntactic tree in another way. Rushdi Shams, Dept of CSE, KUET, Bangladesh 15
  • 16. Do yourself: Label Bracket the tree Rushdi Shams, Dept of CSE, KUET, Bangladesh 16
  • 17. Evaluation of Parsing • The two most frequent and basic measures to evaluate parsing: 17
  • 18. Precision, Recall, and F1-Score • The notions are much clearer with a contingency table- 18
  • 19.
  • 20.
  • 24. Ambiguity • There are 2 types of ambiguity1. Lexical Ambiguity: Sentence contains an idiom/word/term that has more than one meaning. Glasses means both drinking glasses and spectacles Rushdi Shams, Dept of CSE, KUET, Bangladesh 24
  • 25. Ambiguity 2. Structural Ambiguity: Sentence has more than one syntactic tree I saw the boy with the telescope Did you see the boy with a telescope? Or Did you see the boy who was having a telescope? Rushdi Shams, Dept of CSE, KUET, Bangladesh 25
  • 26. Structural Ambiguity Rushdi Shams, Dept of CSE, KUET, Bangladesh 26
  • 27. Ambiguity • Which of the following examples have lexical ambiguity and which of them carry structural ambiguity; justify1. The painter put on another coat 2. We like flying planes 3. Visiting relatives can be tiresome Rushdi Shams, Dept of CSE, KUET, Bangladesh 27
  • 28. Ambiguity • He wrote the note yesterday • You mean you carried the information by a bus? • Connecting wires are tiring in electronics lab • Squad helps dog bite victim Rushdi Shams, Dept of CSE, KUET, Bangladesh 28
  • 29. Word Sense • Most of the lexical ambiguity arises from the differences in word sense. • Word senses vary due to several factors: – Synonymy – Antonymy – Homonymy – Polysemy and – Heteronymy
  • 30. Synonymy • Synonyms are different words (or sometimes phrases) with identical or very similar meanings. • Words that are synonyms are said to be synonymous, and the state of being a synonym is called synonymy Rushdi Shams, Dept of CSE, KUET, Bangladesh 30
  • 31. Synonymy • • • • • student and pupil (noun) buy and purchase (verb) sick and ill (adjective) quickly and speedily (adverb) on and upon (preposition) Rushdi Shams, Dept of CSE, KUET, Bangladesh 31
  • 32. Synonymy is a relation between senses rather than words • Note that synonyms are defined with respect to certain senses of words • pupil as the "aperture in the iris of the eye" is not synonymous with student. • Similarly, he expired means the same as he died, yet my passport has expired cannot be replaced by my passport has died. Rushdi Shams, Dept of CSE, KUET, Bangladesh 32
  • 33. Synonymy is a relation between senses rather than words • Consider the words big and large • Are they synonyms?: – How big is the plane? – Are we travelling with a large or small plane? • How about?: – Mrs Benjamin became a big sister of him – Mrs Benjamin became a large sister of him
  • 34. Heteronymy • heteronyms (also known as heterophones) are words with – identical spellings (or characters) – but different pronunciations and meanings. Rushdi Shams, Dept of CSE, KUET, Bangladesh 34
  • 35. Antonymy • Antonyms are words with opposite or nearly opposite meanings. • short and tall • dead and alive • increase and decrease Rushdi Shams, Dept of CSE, KUET, Bangladesh 35
  • 36. Homonymy • A homonym is one of a group of words that – share the same spelling but – Have different distinct meaning • Bank (Financial Institute) vs Bank (Sloping Land) • Bat (A club for hitting the ball) vs Bat (Mammal) • Homographs (Bank/Bank, Bat/Bat) • Homophones (Right/Write, Piece/Peace) Rushdi Shams, Dept of CSE, KUET, Bangladesh 36
  • 37. Polysemy • Homonymous words that are related with each other – The bank was constructed in 1971 (building related to a financial institute) – I draw money from the bank (financial institute)
  • 38. Hypernymy and Hyponymy • Superclass-subclass structure – Car is a hypernym of Honda – Honda is a hyponym of Car
  • 39. Zeugma Test • A test to see whether or not two words have the same sense – Which flight does serve breakfast? – Does Lufthansa serve Philadelphia? • Simply make a conjunction: – Does Lufthansa serve breakfast and Philadelphia?
  • 40. WordNet 3.0 • A hierarchically organized lexical database • On-line thesaurus + aspects of a dictionary • Some other languages available or under development – (Arabic, Finnish, German, Portuguese…) Category Unique Strings Noun 117,798 Verb 11,529 Adjective 22,479 Adverb 4,481
  • 41. Senses of “bass” in Wordnet
  • 42. WordNet Hypernym Hierarchy for “bass”
  • 44. WordNet 3.0 • Where it is: – http://wordnetweb.princeton.edu/perl/webwn • Libraries – Python: WordNet from NLTK • http://www.nltk.org/Home – Java: • JWNL, extJWNL on sourceforge
  • 45. Difficulties with Natural Language: Anaphora • Using pronouns to refer back to entities already introduced in the text – After Mary proposed to John, they found a preacher and got married. For the honeymoon, they went to Hawaii – Mary saw a ring through the window and asked John for it – Mary threw a rock at the window and broke it Rushdi Shams, Dept of CSE, KUET, Bangladesh 45
  • 46. Difficulties with Natural Language: Indexicality • Indexical sentences refer to utterance situation (place, time, etc.) – I am over here – Why did you do that? Rushdi Shams, Dept of CSE, KUET, Bangladesh 46
  • 47. Difficulties with Natural Language: Metonymy • Using one noun phrase to stand for another – I've read Shakespeare – Chrysler announced record profits – The ham sandwich on Table 4 wants another beer Rushdi Shams, Dept of CSE, KUET, Bangladesh 47
  • 48. Difficulties with Natural Language: Metaphor • “Non-literal" usage of words and phrases, often systematic. – I've tried killing the process but it won't die. Its parent keeps it alive. Rushdi Shams, Dept of CSE, KUET, Bangladesh 48
  • 49. Summary • The components of a language – Lexicon – Categorization – Grammar rules • • • • • Syntactic Tree Label Bracketing Evaluation of Parsing Word sense Problem of Parsing