Quiz games let people test their knowledge through multi-choice questions. Unfortunately, generating such questions can be very time-consuming and it is typically done manually. In this talk we will present a pipeline to automatically generate quiz games starting from generic knowledge (e.g. Wikipedia). The pipeline consists of the following components: (i) a parser to retrieve text from Wikipedia pages, (ii) a Natural Language Processing module (based on the Google Natural Language API) to extract information about syntax, entities and relations, (iii) a Natural Language Generation module to generate test questions and correct answers, and finally (iv) a domain-aware module that uses domain-specific knowledge to generate wrong answers (i.e. distractors). Every module is written in Python and it is based on either available libraries or Cloud services (e.g., Google Natural Language).
1. How to turn Wikipedia into a Quiz Game
7th April 2017
Roberto Turrin Andrea Cappelli
PyCon O:o - Florence, Italy
2. About Us
Roberto Turrin Andrea Cappelli
Head of Technology, PhD Data ScienGst, PhD
@robytur @Skep86
Amazon Echo
3. Agenda
Wikipedia and wikidata as knowledge sources
NLP with Google Natural Language
Using enCCes and dependencies to generate quesCons
IoT integraCon with Alexa
5. Wikipedia and Wikidata
Wikidata stores structured informaCon
about several Wikipedia enCCes.
Wikidata is a document-oriented
database.
Wikidata can be queried
InformaCon is represented by
statements, i.e., key-value pairs.
PetScan
SPARQL
AutoList
6. Querying Wikidata with SPARQL
resource
resource
resource/literal
subject
predicate
object
<urn:x-states:New%20York>
<h.p://purl.org/dc/terms/alterna6ve>
"NY"
“New York has the postal abbrevia6on NY”
12. From statement to quesGon
Homer
Simpson
stole
Ned
‘s
air
conditioner .
nsubj
dobj
steal
• Rephrase the sentence as a
question
Homer Simpson stole Ned’s air conditioner.
https://en.wikipedia.org/wiki/Homer_Simpson https://en.wikipedia.org/wiki/Ned_Flanders
• Identify a relevant phrase and remove it
__________ stole Ned’s air conditioner.
Q: What did Homer Simpson steal?
A: Ned’s air conditioner.
13. What about wrong answers?
appears in
The Simpsons (Q886)
Good “wrong answers”
(distractors) for quizzes
…
appears in
appears in appears in appears in
Q646166
Q727156 Q324430
Homer Simpson stole Ned’s air conditioner.
Q7810
16. What is Amazon Alexa (Echo Dot)?
Based on Amazon Alexa Voice service
Enabling HCI via voice
Quick build with AWS Lambda or
poinCng to web API
Intent-based with slot-filling
Retains memory within each
session
“Has Skills”
17. Deploying Alexa Skills
Create new skill (name and invocaCon)
Define intents, slots and
uberances
Link to Lambda or web API
Test