SlideShare a Scribd company logo
Analyzing Arguments during a
Debate using Natural Language
Processing in Python - I
ABHINAV GUPTA
How a debate may proceed
This new movie ‘Superman
vs. Batman’ is so cool! The
winner has got to be
Superman, with his mighty
Kryptonian abilities and
people’s support. What do
you think?!
I agree! Superman is definitely
more capable than Batman.
What are you saying? Batman is
so much technologically
advanced!
Both, Batman and Superman,
are powerful in their own ways.
It will be a draw.
Ben Affleck is so HOT!
What will we discuss?
 Basic Natural Language Processing (NLP) techniques
 Implementation of NLP in Python NLTK
 Stepwise workflow for processing arguments in a debate to:
 Determine polarity of an argument
 Determine quality of argument and score it
 Determine the winner of debate
 A complete debating framework built from various Python modules
Why Natural Language Toolkit (NLTK)?
 Platform for implementing Natural
Language Processing through Python
programs
 Huge database of corpora and lexical
resources with an easy interface
 Built-in libraries of several text
processing algorithms
 Open Source!
Starting with the Basics
“I do not feel very good about Monday mornings.”
Tokenization [‘I’, ‘do’, ‘not’, ‘feel’, ‘very’, ‘good’, ‘about’, ‘Monday’, ‘mornings’]
Parts of Speech Tagging ‘I’ – Personal Pronoun
‘do’ – Verb
‘not’ – Adverb
‘feel’ - Verb,
‘very’ – Adverb
‘good’ – Adjective
‘about’ – Preposition
‘Monday’ – Proper Noun
‘mornings’ – Plural Proper Noun]
Basics with NLTK
Tokens [‘I’, ‘do’, ‘not’, ‘feel’, ‘very’, ‘good’, ‘about’, ‘Monday’, ‘mornings’]
Removal of Stop Words [‘I’, ‘feel’, ‘good’, ‘Monday’, ‘mornings’]
Stemmed Words [‘I’, ‘feel’, ‘good’, ‘Monday’, ‘morn’]
What we look for in an argument?
What is the stance taken by
the debater in this argument?
Has the debater changed stance
from the previous arguments?
Is the argument related to the
debate or irrelevant?
Is the argument good enough?
Analysis of an Argument
• Is the argument
related to the
debate?
SEMANTIC
SIMILARITY
• What is the
polarity of the
argument?
SENTIMENT
ANALYSIS • Is the argument
good enough?
SCORING
• Has the debater
changed
stance?
BACKTRACK
Semantic Similarity
 Semantic Distance between words in context is the distance between their
underlying senses or lexical concepts.
 d(festival, celebration) < d(school, circus)
 Semantic Similarity is how close the lexical concepts of two units (word, sentence,
paragraph) of language are.
 d(Mangoes and bananas are fruits, Mangoes are sweeter than bananas) < d(Raj has a job at the
hospital, Hospitals have a huge staff of doctors and nurses)
 Lexical databases like WordNet group English words into sets of synonyms
expressing a distinct concept and are used for calculating semantic similarity
Word Net based Similarity
Such a network forms the basis of several distance formulae to calculate semantic similarity
Similarity between Sentences
A new NASA initiative will
help lead the search for signs
of life beyond our solar
system
The Nexus for Exoplanet
System Science, or NExSS,
will take a multidisciplinary
approach to the hunt for
alien life
new
NASA
Initiative
Help
Lead
Search
Signs
Life
Beyond
Solar
System
Nexus
Exoplanet
Alien
Science
NExSS
Take
multidisciplinary
Approach
Hunt
Joint Word Set
Sentence 1
Sentence 2
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1 2
Similarity between Sentences
 The simplest similarity score is to take the cosine distance between the two vectors:
 More sophisticated formulae identify similar pair of words and assign decimal
values depending on the semantic distance. For example, in our word set,
 d(Search, Hunt) = 0.8
 d(Solar, Exoplanet) = 0.4
 Sometimes, the order in which the words appear in the sentence also make a
difference. Order Similarity is also considered.
 India defeated Pakistan
 Pakistan defeated India
Sentiment Analysis
 Sentiment Analysis (or opinion mining) is the process of detecting the contextual
polarity of text
 NLP Techniques, Statistics and Machine Learning is used to identify the sentiment
content in a text
 It finds application with Movie Reviews, Blogs, Customer Feedback, Twitter and
other microblogging sources
 Most popular classifier used for Sentiment Analysis is the Naïve Bayes Classifier,
available as a module in NLTK and TextBlob, a Python library for textual data
Sentiment Analysis using Naïve Bayes
Training Corpus
Polarity Lexicon
Naïve Bayes
Classifier
Neutral?
Test Data Yes
Positive/Negative
Thank You!
Please keep watching
this space for Part II

More Related Content

PPTX
Analyzing Arguments during a Debate using Natural Language Processing in Python
PPTX
Adapting Sentiment Lexicons using Contextual Semantics for Sentiment Analysis...
PDF
IRJET- A System for Determining Sarcasm in Tweets: Sarcasm Detector
PPTX
SentiCircles for Contextual and Conceptual Semantic Sentiment Analysis of Twi...
PDF
Rule based approach to sentiment analysis at ROMIP 2011
PPT
Are abstract concepts structured via more concrete concepts
PPTX
Semantic Patterns for Sentiment Analysis of Twitter
PPTX
02 naive bays classifier and sentiment analysis
Analyzing Arguments during a Debate using Natural Language Processing in Python
Adapting Sentiment Lexicons using Contextual Semantics for Sentiment Analysis...
IRJET- A System for Determining Sarcasm in Tweets: Sarcasm Detector
SentiCircles for Contextual and Conceptual Semantic Sentiment Analysis of Twi...
Rule based approach to sentiment analysis at ROMIP 2011
Are abstract concepts structured via more concrete concepts
Semantic Patterns for Sentiment Analysis of Twitter
02 naive bays classifier and sentiment analysis

Similar to Argumentation Framework (20)

PDF
HackYale - Natural Language Processing (All Slides)
PPTX
Coreference_Resolution in Natural language processing
PDF
A^2_Poster
PPTX
Pycon ke word vectors
PDF
Do you Mean what you say? Recognizing Emotions.
PDF
Natural Language Processing
PDF
CSCE181 Big ideas in NLP
PDF
Lean Logic for Lean Times: Varieties of Natural Logic
PDF
Deep Learning for NLP: An Introduction to Neural Word Embeddings
PPTX
Variation in speech tempo: Capt. Kirk, Mr. Spock, and all of us in between
PPT
Natural Language Processing
PPTX
NLP in Practice - Part II
PPT
1680242330325_Knowledge Representation1 (1).ppt
PDF
Semeval Deep Learning In Semantic Similarity
PPTX
Nltk
PPT
sa-mincut-aditya.ppt
PPTX
NLP Introduction and basics of natural language processing
PPTX
DATA641 Lecture 3 - Word meaning.pptx
PPT
ppt on sentiment analysis using various techniques
HackYale - Natural Language Processing (All Slides)
Coreference_Resolution in Natural language processing
A^2_Poster
Pycon ke word vectors
Do you Mean what you say? Recognizing Emotions.
Natural Language Processing
CSCE181 Big ideas in NLP
Lean Logic for Lean Times: Varieties of Natural Logic
Deep Learning for NLP: An Introduction to Neural Word Embeddings
Variation in speech tempo: Capt. Kirk, Mr. Spock, and all of us in between
Natural Language Processing
NLP in Practice - Part II
1680242330325_Knowledge Representation1 (1).ppt
Semeval Deep Learning In Semantic Similarity
Nltk
sa-mincut-aditya.ppt
NLP Introduction and basics of natural language processing
DATA641 Lecture 3 - Word meaning.pptx
ppt on sentiment analysis using various techniques
Ad

Recently uploaded (20)

PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
CyberSecurity Mobile and Wireless Devices
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
Soil Improvement Techniques Note - Rabbi
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
PPTX
Feature types and data preprocessing steps
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
Amdahl’s law is explained in the above power point presentations
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
CyberSecurity Mobile and Wireless Devices
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Exploratory_Data_Analysis_Fundamentals.pdf
"Array and Linked List in Data Structures with Types, Operations, Implementat...
Abrasive, erosive and cavitation wear.pdf
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Soil Improvement Techniques Note - Rabbi
737-MAX_SRG.pdf student reference guides
Information Storage and Retrieval Techniques Unit III
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Feature types and data preprocessing steps
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Amdahl’s law is explained in the above power point presentations
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Module 8- Technological and Communication Skills.pptx
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Ad

Argumentation Framework

  • 1. Analyzing Arguments during a Debate using Natural Language Processing in Python - I ABHINAV GUPTA
  • 2. How a debate may proceed This new movie ‘Superman vs. Batman’ is so cool! The winner has got to be Superman, with his mighty Kryptonian abilities and people’s support. What do you think?! I agree! Superman is definitely more capable than Batman. What are you saying? Batman is so much technologically advanced! Both, Batman and Superman, are powerful in their own ways. It will be a draw. Ben Affleck is so HOT!
  • 3. What will we discuss?  Basic Natural Language Processing (NLP) techniques  Implementation of NLP in Python NLTK  Stepwise workflow for processing arguments in a debate to:  Determine polarity of an argument  Determine quality of argument and score it  Determine the winner of debate  A complete debating framework built from various Python modules
  • 4. Why Natural Language Toolkit (NLTK)?  Platform for implementing Natural Language Processing through Python programs  Huge database of corpora and lexical resources with an easy interface  Built-in libraries of several text processing algorithms  Open Source!
  • 5. Starting with the Basics “I do not feel very good about Monday mornings.” Tokenization [‘I’, ‘do’, ‘not’, ‘feel’, ‘very’, ‘good’, ‘about’, ‘Monday’, ‘mornings’] Parts of Speech Tagging ‘I’ – Personal Pronoun ‘do’ – Verb ‘not’ – Adverb ‘feel’ - Verb, ‘very’ – Adverb ‘good’ – Adjective ‘about’ – Preposition ‘Monday’ – Proper Noun ‘mornings’ – Plural Proper Noun]
  • 7. Tokens [‘I’, ‘do’, ‘not’, ‘feel’, ‘very’, ‘good’, ‘about’, ‘Monday’, ‘mornings’] Removal of Stop Words [‘I’, ‘feel’, ‘good’, ‘Monday’, ‘mornings’] Stemmed Words [‘I’, ‘feel’, ‘good’, ‘Monday’, ‘morn’]
  • 8. What we look for in an argument? What is the stance taken by the debater in this argument? Has the debater changed stance from the previous arguments? Is the argument related to the debate or irrelevant? Is the argument good enough?
  • 9. Analysis of an Argument • Is the argument related to the debate? SEMANTIC SIMILARITY • What is the polarity of the argument? SENTIMENT ANALYSIS • Is the argument good enough? SCORING • Has the debater changed stance? BACKTRACK
  • 10. Semantic Similarity  Semantic Distance between words in context is the distance between their underlying senses or lexical concepts.  d(festival, celebration) < d(school, circus)  Semantic Similarity is how close the lexical concepts of two units (word, sentence, paragraph) of language are.  d(Mangoes and bananas are fruits, Mangoes are sweeter than bananas) < d(Raj has a job at the hospital, Hospitals have a huge staff of doctors and nurses)  Lexical databases like WordNet group English words into sets of synonyms expressing a distinct concept and are used for calculating semantic similarity
  • 11. Word Net based Similarity Such a network forms the basis of several distance formulae to calculate semantic similarity
  • 12. Similarity between Sentences A new NASA initiative will help lead the search for signs of life beyond our solar system The Nexus for Exoplanet System Science, or NExSS, will take a multidisciplinary approach to the hunt for alien life new NASA Initiative Help Lead Search Signs Life Beyond Solar System Nexus Exoplanet Alien Science NExSS Take multidisciplinary Approach Hunt Joint Word Set Sentence 1 Sentence 2 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 2
  • 13. Similarity between Sentences  The simplest similarity score is to take the cosine distance between the two vectors:  More sophisticated formulae identify similar pair of words and assign decimal values depending on the semantic distance. For example, in our word set,  d(Search, Hunt) = 0.8  d(Solar, Exoplanet) = 0.4  Sometimes, the order in which the words appear in the sentence also make a difference. Order Similarity is also considered.  India defeated Pakistan  Pakistan defeated India
  • 14. Sentiment Analysis  Sentiment Analysis (or opinion mining) is the process of detecting the contextual polarity of text  NLP Techniques, Statistics and Machine Learning is used to identify the sentiment content in a text  It finds application with Movie Reviews, Blogs, Customer Feedback, Twitter and other microblogging sources  Most popular classifier used for Sentiment Analysis is the Naïve Bayes Classifier, available as a module in NLTK and TextBlob, a Python library for textual data
  • 15. Sentiment Analysis using Naïve Bayes Training Corpus Polarity Lexicon Naïve Bayes Classifier Neutral? Test Data Yes Positive/Negative
  • 16. Thank You! Please keep watching this space for Part II