alexgreene / WikiQuiz

Generates a quiz for a Wikipedia page using parts of speech and text chunking.
MIT License
803 stars 58 forks source link

Make it less likely to show duplicate answers #12

Closed c-w closed 7 years ago

c-w commented 7 years ago

Previously, we generated two incorrect answers for every question by sampling with replacement from the pool of all possible entities for some question. This means that we can display duplicate answers for a question in two scenarios: (1) we sample the same incorrect answer twice, or (2) one of the sampled incorrect answers is the same as the correct answer.

This commit adds some retry logic to the front-end that re-samples the incorrect answers if any of the two conditions above occurred. This does not eliminate the possibility of duplicate answers being displayed (e.g. consider the situation where we only have two candidate answers), but it should greatly reduce the impact to the user.

Fixes #5