Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a random quiz question from the Wolfram Knowledgebase
ResourceFunction["RandomEntityQuestion"][] generates a QuestionObject about a random property of a random Entity. | |
ResourceFunction["RandomEntityQuestion"][type] generates a QuestionObject about a random property of a random Entity of the specified type. | |
ResourceFunction["RandomEntityQuestion"][type,prop] generates a QuestionObject about the property prop. | |
ResourceFunction["RandomEntityQuestion"][EntityProperty[type,prop]] generates a QuestionObject about a property prop of a random Entity of the specified type. |
"AnswerProperty" | "Name" | which property is used in the answer choices |
"ChoiceCount" | 3 | the number of choices to offer as the answer to the question |
"QuestionText" | Automatic | the text to appear as the question prompt |
MaxRecursion | 4 | the number of times to seek nonduplicate, nonmissing answers |
Ask a question about a random capital city from the "Country" Entity data:
In[1]:= |
Out[1]= |
Ask a question about a random director from the "Movie" Entity data:
In[2]:= |
Out[2]= |
Ask a question about a random aspect of a movie:
In[3]:= |
Out[3]= |
Generate a question about any topic known to the Wolfram Knowledgebase:
In[4]:= |
Out[4]= |
Generate a random question about dog breeds with images as answer choices:
In[5]:= |
Out[5]= |
The Entity type can also be specified with EntityClass or related EntityClass constructors:
In[6]:= |
Out[6]= |
By default, the property value is used in the question prompt and the entity labels are used as the choices:
In[7]:= |
Out[7]= |
To reverse the format, use the option "AnswerProperty":
In[8]:= |
Out[8]= |
Use a specific property together with "AnswerProperty" to make questions that do not involve the Entity name:
In[9]:= |
Out[9]= |
Use "ChoiceCount" to change the number of choices provided:
In[10]:= |
Out[10]= |
Use "QuestionText" to change the prompt:
In[11]:= |
Out[11]= |
If there are insufficient nonduplicate, nonmissing answers found, then RandomEntityQuestion will return $Failed:
In[12]:= |
Out[12]= |
This work is licensed under a Creative Commons Attribution 4.0 International License