SlideShare una empresa de Scribd logo
1 de 16
Descargar para leer sin conexión
Playing
Trivia with
a Bot
Jose Nazario
<jose@monkey.org>
History
~2005? Created "#trivia" for my wife
Uses Blitzed Trivia bot, "brainiac", and a 110k
question/answer DB
Winter 2012 had an interest in NLP for potential
project
Decided to tackle a "toy problem"
"Let's play trivia!"
Goals
Learn NLP via NLTK
Build a bot that can play trivia "competitively"
Natural Language Processing (NLP)
Algorithms that can parse and process human
language
Major field of study related to AI, useful in
● Machine translation
● Grammar induction
● Information extraction
● Sentence understanding
Challenges & Advantages
Unlike Jeopardy
● Can answer question wrong and not get
penalized, try multiple times
● No puns or wordplay, straightforward
questions
Still ...
● Have to have a knowledge base - Google
● Have to be able to figure out the right
answer
Watson Components
Simple IRC library (not irclib)
NLTK - Natural Language Toolkit
Logic
Hand crafted
Base Assumptions
"Google knows all" - no need to make a local
knowledge database
The right answer will be commonly seen,
exploit that repetition
Watson 1.0
~100 LoC, "an evening of futzing around"
"Strategy"
1. Read the question
2. Throw it at Google, get a result page
3. Find all the proper names (via NLTK) from
page titles, rank by frequency
4. Guess those sequentially
Watson 1.0 Results
Very poor performance
Not surprising
Watson 2.0
Written a few days later
~300 LoC, "actually had to think this time"
Strategy
● Check a DB of cached questions and
answers (from observations), use similar
ones if possible
● Read question, throw at Google (or Bing)
● Figure out what kind of answer is expected,
extract matching text via NLTK and scoring
● If we get a hint, use it (as a regex)
Extracting Answers from Web Pages
Challenge
Web pages contain a lot of junk around the
answer
How do we find what the answer in the sea of
words?
Simple strategy - extract proper names!
(The trivia DB often has proper names for
answers)
Where is Watson these days?

00:08 < brainiac> Congratulations to
rogueclown who has won this round! What a
brain!
00:08 < brainiac> Final scores:
00:08 < brainiac>
rogueclown: 10
00:08 < brainiac>
watson: 9
00:08 < brainiac>
purge: 2

irc://coffee.ofdoom.org:6667/#trivia
Additional Ideas for Watson 2.0
New search engines
Bing, Ask, Wolfram Alpha
Prune knowledge base
Weed out useless “answers”
New/different named entity recognition engine
Experiment with scoring algorithms for guesses
Disappointments
Only a minor increase in my knowledge of NLP
I did not become an NLP maestro
No one else built a bot
Was hoping for a competition
Watson 3 .. sorta in the works
Ideas
Natural language interface to semantic web (e.g.
QuestIO, Quepy), SPARQL endpoints
Wolfram Alpha-like UI, research prototypes
available
Teach the bot what kind of answer to look for
Quantity, dates, names, etc
Probabalistic programming? Marry answers with
confidence
IBM Watson Links
http://www.kurzweilai.net/how-watson-works-aconversation-with-eric-brown-ibm-researchmanager
http://researcher.ibm.
com/researcher/view_project.php?id=2099
(Special issue of IBM JR&D on Watson)

Más contenido relacionado

Similar a Playing Trivia with a Bot

Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles ThinkingGrokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles Thinking
Grokking VN
 

Similar a Playing Trivia with a Bot (20)

Chatbots and Deep Learning
Chatbots and Deep LearningChatbots and Deep Learning
Chatbots and Deep Learning
 
Get connected with python
Get connected with pythonGet connected with python
Get connected with python
 
Natural language Analysis
Natural language AnalysisNatural language Analysis
Natural language Analysis
 
IACT-TAP New School Thinking - Prototype Workshop
IACT-TAP New School Thinking - Prototype WorkshopIACT-TAP New School Thinking - Prototype Workshop
IACT-TAP New School Thinking - Prototype Workshop
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?
 
Artificial Intelligence (Unit - 2).pdf
Artificial Intelligence   (Unit  -  2).pdfArtificial Intelligence   (Unit  -  2).pdf
Artificial Intelligence (Unit - 2).pdf
 
CFP workshop
CFP workshopCFP workshop
CFP workshop
 
Machine Learning: Expertise On-Demand
Machine Learning: Expertise On-DemandMachine Learning: Expertise On-Demand
Machine Learning: Expertise On-Demand
 
Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles ThinkingGrokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles Thinking
 
How to build a perfect ML-based question answering model which doesn't work -...
How to build a perfect ML-based question answering model which doesn't work -...How to build a perfect ML-based question answering model which doesn't work -...
How to build a perfect ML-based question answering model which doesn't work -...
 
Pycon India 2018 Natural Language Processing Workshop
Pycon India 2018   Natural Language Processing WorkshopPycon India 2018   Natural Language Processing Workshop
Pycon India 2018 Natural Language Processing Workshop
 
Beyond the Symbols: A 30-minute Overview of NLP
Beyond the Symbols: A 30-minute Overview of NLPBeyond the Symbols: A 30-minute Overview of NLP
Beyond the Symbols: A 30-minute Overview of NLP
 
Expertise on Demand - How machine learning puts the best-of-the-best at your ...
Expertise on Demand - How machine learning puts the best-of-the-best at your ...Expertise on Demand - How machine learning puts the best-of-the-best at your ...
Expertise on Demand - How machine learning puts the best-of-the-best at your ...
 
Mastering Prototyping: How to Quickly Playtest Your Game Ideas | Ron Rejwan
Mastering Prototyping: How to Quickly Playtest Your Game Ideas | Ron RejwanMastering Prototyping: How to Quickly Playtest Your Game Ideas | Ron Rejwan
Mastering Prototyping: How to Quickly Playtest Your Game Ideas | Ron Rejwan
 
top developer mistakes
top developer mistakes top developer mistakes
top developer mistakes
 
Deep Learning, an interactive introduction for NLP-ers
Deep Learning, an interactive introduction for NLP-ersDeep Learning, an interactive introduction for NLP-ers
Deep Learning, an interactive introduction for NLP-ers
 
Think machine-learning-with-scikit-learn-chetan
Think machine-learning-with-scikit-learn-chetanThink machine-learning-with-scikit-learn-chetan
Think machine-learning-with-scikit-learn-chetan
 
How do OpenAI GPT Models Work - Misconceptions and Tips for Developers
How do OpenAI GPT Models Work - Misconceptions and Tips for DevelopersHow do OpenAI GPT Models Work - Misconceptions and Tips for Developers
How do OpenAI GPT Models Work - Misconceptions and Tips for Developers
 
Behind the Scenes of ChatGPT.pptx
Behind the Scenes of ChatGPT.pptxBehind the Scenes of ChatGPT.pptx
Behind the Scenes of ChatGPT.pptx
 
Breaking Through The Challenges of Scalable Deep Learning for Video Analytics
Breaking Through The Challenges of Scalable Deep Learning for Video AnalyticsBreaking Through The Challenges of Scalable Deep Learning for Video Analytics
Breaking Through The Challenges of Scalable Deep Learning for Video Analytics
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Playing Trivia with a Bot

  • 1. Playing Trivia with a Bot Jose Nazario <jose@monkey.org>
  • 2. History ~2005? Created "#trivia" for my wife Uses Blitzed Trivia bot, "brainiac", and a 110k question/answer DB Winter 2012 had an interest in NLP for potential project Decided to tackle a "toy problem" "Let's play trivia!"
  • 3. Goals Learn NLP via NLTK Build a bot that can play trivia "competitively"
  • 4. Natural Language Processing (NLP) Algorithms that can parse and process human language Major field of study related to AI, useful in ● Machine translation ● Grammar induction ● Information extraction ● Sentence understanding
  • 5. Challenges & Advantages Unlike Jeopardy ● Can answer question wrong and not get penalized, try multiple times ● No puns or wordplay, straightforward questions Still ... ● Have to have a knowledge base - Google ● Have to be able to figure out the right answer
  • 6. Watson Components Simple IRC library (not irclib) NLTK - Natural Language Toolkit Logic Hand crafted
  • 7. Base Assumptions "Google knows all" - no need to make a local knowledge database The right answer will be commonly seen, exploit that repetition
  • 8. Watson 1.0 ~100 LoC, "an evening of futzing around" "Strategy" 1. Read the question 2. Throw it at Google, get a result page 3. Find all the proper names (via NLTK) from page titles, rank by frequency 4. Guess those sequentially
  • 9. Watson 1.0 Results Very poor performance Not surprising
  • 10. Watson 2.0 Written a few days later ~300 LoC, "actually had to think this time" Strategy ● Check a DB of cached questions and answers (from observations), use similar ones if possible ● Read question, throw at Google (or Bing) ● Figure out what kind of answer is expected, extract matching text via NLTK and scoring ● If we get a hint, use it (as a regex)
  • 11. Extracting Answers from Web Pages Challenge Web pages contain a lot of junk around the answer How do we find what the answer in the sea of words? Simple strategy - extract proper names! (The trivia DB often has proper names for answers)
  • 12. Where is Watson these days? 00:08 < brainiac> Congratulations to rogueclown who has won this round! What a brain! 00:08 < brainiac> Final scores: 00:08 < brainiac> rogueclown: 10 00:08 < brainiac> watson: 9 00:08 < brainiac> purge: 2 irc://coffee.ofdoom.org:6667/#trivia
  • 13. Additional Ideas for Watson 2.0 New search engines Bing, Ask, Wolfram Alpha Prune knowledge base Weed out useless “answers” New/different named entity recognition engine Experiment with scoring algorithms for guesses
  • 14. Disappointments Only a minor increase in my knowledge of NLP I did not become an NLP maestro No one else built a bot Was hoping for a competition
  • 15. Watson 3 .. sorta in the works Ideas Natural language interface to semantic web (e.g. QuestIO, Quepy), SPARQL endpoints Wolfram Alpha-like UI, research prototypes available Teach the bot what kind of answer to look for Quantity, dates, names, etc Probabalistic programming? Marry answers with confidence