
Show HN: Generate a quiz from a Wikipedia page - alex_g
https://github.com/alexgreene/WikiQuiz
======
ORioN63
Have you thought about using dbpedia?

[https://en.wikipedia.org/wiki/DBpedia](https://en.wikipedia.org/wiki/DBpedia)

~~~
frik
Has someone tried to host a DBpedia copy offline?

The supported Virtuoso database is quite esoteric (
[https://en.wikipedia.org/wiki/Virtuoso_Universal_Server](https://en.wikipedia.org/wiki/Virtuoso_Universal_Server)
).

Has one succeeded writing a script to import the data to Postgres, MySQL or
Lucene?

~~~
nl
I've hosted it in Jena, and I think most graph databases include importers.

You need a RDF/Graph database (unless you are up for a lot of re-engineering)

------
alex_g
Built this last week as part of the interview process for a job. I know it's
flawed, but in my opinion neat nonetheless!

~~~
Cyph0n
Excellent idea. There are a lot of interesting ways to improve this, but you
have an MVP running, which is a good start.

Regarding your codebase: clear and to-the-point code, well commented, and
helpful commit messages. Including a `requirements.txt` is a plus.

Good job, keep it up!

~~~
sAbakumoff
Well, I believe that any code should be readable enough so that the comments
like below wouldn't be required.

# splits a Wikipedia section into sentences # and then chunks/tokenizes each
sentence

If I had interviewed the author, I would have asked him what's the purpose of
commenting like that.

~~~
aldarn
I believe it's easier to read a native language than code. I would also
counter there is no harm to comments like this so just because you don't find
it useful doesn't mean someone else won't.

~~~
sAbakumoff
Okay. My point is in that in the real job you don't have time for writing this
type of comments. Instead you have your current task to work on, the issue
that was re-opened and needs to be revisited, the bug to argue with QA about,
the deadline to discuss with PM, the code-review to do ASAP. You simply don't
have time to write the perfect code that is full of the comments in the
"native language".

~~~
yosamino
This rather sounds like you don't have the time to _not_ do it.

Imagine using the time that spent on "re"-visiting "re"-opened bugs that are
vague enough to be argued about on writing code that doesn't need these "re"s
in the first place.

I contend that that might be a difficult place to get to especially because
it's a team effort as well, but I feel it's more productive and less stressful
to work like that.

~~~
sAbakumoff
I am too long in IT to imagine anything like that.

------
deskglass
Those interested in this may also be interested in
[https://en.wikipedia.org/wiki/Incremental_reading](https://en.wikipedia.org/wiki/Incremental_reading)
which gradually converts reading material into flashcards that are memorized
using spaced repetition software.

------
nessup
This is so cool!

Let me know if you plan on continuing it. I'd love to collaborate.

~~~
alex_g
Thanks! let's chat: @alexg473 (twitter) or alexgrn7 (gmail)

------
xanderjanz
For the lazy, hosted: [https://wiki-quiz.herokuapp.com/](https://wiki-
quiz.herokuapp.com/)

~~~
alex_g
Thank you kind fellow!

~~~
xanderjanz
no worries, cool project. Here's the changes I had to make to make it hostable
if you're interested.:
[https://github.com/lutherism/WikiQuiz/commits/master](https://github.com/lutherism/WikiQuiz/commits/master)

------
huevosabio
Ha! For a class in school we had to create a web app that allowed people to
create quizzes and challenge others. Among the question types we implemented a
sort of fill in the blank using Wikipedia random article feature
([https://en.m.wikipedia.org/wiki/Special:Random](https://en.m.wikipedia.org/wiki/Special:Random))

~~~
n1try
Can you tell more about that web app? Are the quizzes generated automatically
and if so, how did you extract the information?

------
alex_g
UPDATE: I'm truly excited about all of the feedback this project has received.
Credit to Volley ([http://volley.com](http://volley.com)) for
requesting/inspiring this project!

------
pwdisswordfish
> In Australian aboriginal mythology, ? is a god of earthly knowledge and
> physical might, created by Altjira to ensure that people did not get too
> arrogant or self-conceited.

[Jar'Edo Wens]

> Correct!

------
lappet
It appears that there is an open issue[1] in the Wikipedia python library
where it does not list the different sections in a wikipedia page. So right
now, this would only generate questions from the "Summary" section of any
wikipedia page.

[1]
[https://github.com/goldsmith/Wikipedia/issues/119](https://github.com/goldsmith/Wikipedia/issues/119)

------
anlif
Would be awesome if this could be used to generate a Kahoot quiz:
[https://kahoot.it/](https://kahoot.it/)

------
omash
Thanks for sharing this. I've done a similar thing to help study for exams
except with pattern matching instead of nltk. I'm looking forward to
understanding the natural language part.

It's very buggy though... I get more invalid questions than good ones, haha

------
sonium
I cloned the repository and installed the requirements but after starting
'python python/server.py' I get a 404 if I try to open index.html as
described. Anyone else having that problem?

~~~
xanderjanz
Don't go to localhost:5000/, like you might think. Open
file://.../WikiQuiz/index.html as a file in Chrome. It will make ajax requests
to localhost:5000

------
divbit
thats the idea behind
[http://github.com/divbit/grimoire](http://github.com/divbit/grimoire) as
well, except more for private notes.

~~~
divbit
"grok" mode does a quiz on all notes of a certain topic

~~~
divbit
srry readme a bit out of date..

------
azazqadir
Nice, but still has some room for improvements

[http://i.imgur.com/EVToWfI.png](http://i.imgur.com/EVToWfI.png)

~~~
alex_g
The hosted demo isn't looking past the summary of the wiki article. If you
follow the instructions on the README and run it locally it will have a much
larger pool of answers/choices.

------
marak830
I really could have used this when I was teaching English at high schools.
Thanks for the link, I will defiantly be sharing with mates still in the
industry.

------
kr0
A novel idea but the example screenshot looks really trivial. I'm not sure
that it is Triumph but it being in the question narrows it down.

------
lappet
Nice! I am guessing you don't want to hard code the domain/hostname in
script.js (line 40) ?

~~~
alex_g
Right, it's just localhost right now, so I don't think it matters.

~~~
lappet
Btw I am unable to get it working locally. I only see 404s. Do I need anything
special to serve the static files?

~~~
alex_g
Happy to help. The static files should only be accessed by opening index.html
in your browser. From another user: "Don't go to localhost:5000/, like you
might think. Open file://.../WikiQuiz/index.html as a file in Chrome. It will
make ajax requests to localhost:5000"

~~~
lappet
Ah I see, thanks for the help. Now I see 500s even though I have installed
both the nltk packages. Hmm.

~~~
lappet
The exception appears to be:

<class 'TypeError'>, TypeError("a bytes-like object is required, not 'str'",),

~~~
alex_g
Try reverting the changes from:
[https://github.com/alexgreene/WikiQuiz/commit/9696fe29b413a6...](https://github.com/alexgreene/WikiQuiz/commit/9696fe29b413a6dbcf85f03f0e373fa297c0b8db)

Please report back if that worked or not with an Issue on the repo, so I can
follow up with a fix. Thanks!

------
filipmandaric
Seems like a good idea, it would be great if there was a demo available.

~~~
alex_g
Sorry for that, I wasn't releasing this as a product, and certainly didn't
expect it to get this much attention! Maybe a v2 of this will have its own
server :)

------
jameswason
That's interesting!

------
frogpelt
Really cool idea!

Unfortunately, I'm getting a 500 error on every request.

What did I do wrong?

~~~
n1try
Managed it by doing nltk.download('punkt')

~~~
omash
Fixed it for me too, thanks. How did you debug the issue?

------
alphabettsy
It needs a better example.

------
flootch
Can you make it a multiplayer game played on phones, tablets, and watches,
tvs, and cars? Okay, maybe not cars.

~~~
filipmandaric
You never know, people are going to have a lot of free time in cars pretty
soon.

------
rasz_pl
that picture is not that great of an example, answer is right in the question.

