"DragCompletion" (Question Interface Type)
"DragCompletion"
provides a fill-in the-blank interface with slots to fill by dragging items from a common pool.
Properties
- The "DragCompletion" interface is not supported in the Wolfram Cloud.
- In QuestionInterface["DragCompletion",props], props is an Association that supports the following keys:
-
"Prompt" None text asking the user a question "Template" (required) template object with slots to be filled "Choices" Automatic available choices "ChoiceOrdering" Automatic function for ordering choices - The "Template" can be any content supported by TemplateObject or StringTemplate. When providing a string, template slots denoted by backticks `` define locations for blanks in the question interface.
- By default, the "Choices" are inherited from the AssessmentFunction and randomly sorted to avoid exposing the correct answer.
- When provided directly, "Choices" should have the form {item1,item2,…}. By default, the order will be maintained as provided.
- When "ChoiceOrdering"f is specified, the items will be presented as f[{item1,item2,…}].
Corresponding AssessmentFunction
- "DragCompletion" is not an automatically assigned interface type for an AssessmentFunction. It must be specified in QuestionInterface.
- The values vali in AssessmentFunction[{val1,…},…] should contain the answers for each slot in order.
Examples
open all close allBasic Examples (3)
Define a drag-completion question with assessment:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blanks", "Template" -> "The biggest planet in the solar system is ``, and the smallest planet is ``"|>], AssessmentFunction[{{"Jupiter", "Mercury"} -> 1, {"Mars", "Venus"} -> 0, {"Mars", "Saturn"} -> 0}]]Create a drag-completion question without assessment:
QuestionObject[QuestionInterface["DragCompletion", <|"Template" -> "Star Wars Episode ``", "Choices" -> {"4: A New Hope", "5: Empire Strikes Back", "6: Return of the Jedi"}, "Prompt" -> "Choose your favorite Star Wars movie"|>]]Specify the choices directly using entities:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blanks", "Template" -> "The biggest planet in the solar system is ``, and the smallest planet is ``", "Choices" -> EntityList@EntityClass["Planet", All]|>], AssessmentFunction[{{Entity["Planet", "Jupiter"], Entity["Planet", "Mercury"]}}]]A question with multiple correct answers:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blanks", "Template" -> "During the process of photosynthesis, plants absorb `` and release ``."|>], AssessmentFunction[{{Entity["Chemical", "CarbonDioxide"], ["O2"]} -> 1, {Entity["Chemical", "Water"], ["O2"]} -> 1, {Entity["Chemical", "Methane"], Entity["Chemical", "Ozone"]} -> 0}]]Scope (2)
Use TemplateObject to provide a template:
to = TemplateObject[Row[{1, 1, 2, 3, TemplateSlot[1], 8, TemplateSlot[2], 21, 34}, ", "], InsertionFunction -> Identity, CombinerFunction -> Identity]QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Complete the sequence", "Choices" -> Range[3, 15], "Template" -> to|>], AssessmentFunction[{5, 13} -> 1]]The choices can be any type of expression. Create a drag-completion question with images:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blanks", "Template" -> "The furthest north country in the Group of Seven is ``",
"Choices" -> (ImageResize[#, 30]& /@ EntityValue[EntityClass["Country", "GroupOf7"], "FlagImage"])|>], AssessmentFunction[{{[image]}}, "Expression"]]Properties & Relations (1)
Use the setting "ChoiceOrdering"f to specify a function for sorting the choices in the interface:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blanks to create a sentence", "Template" -> "What `` `` `` ``?", "Choices" -> {"doing", "am", "are", "you", "now"}, "ChoiceOrdering" -> AlphabeticSort|>], AssessmentFunction[{{"are", "you", "doing", "now"} -> 1,
{"are", "you", "now", "doing"} -> 1}]]Possible Issues (1)
The values in the AssessmentFunction should be lists:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blank", "Template" -> "apples are ``", "Choices" -> {"red", "blue", "purple"}|>], AssessmentFunction["red" -> 1]]Specify the values as a list instead:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blank", "Template" -> "apples are ``", "Choices" -> {"red", "blue", "purple"}|>], AssessmentFunction[{"red"} -> 1]]Interactive Examples (1)
Create a QuestionGenerator for a "DragCompletion" question:
alkali = EntityList@EntityClass["Element", "AlkaliMetal"]chemtest = QuestionGenerator[{"elem" :> RandomChoice[alkali]}, QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Choose the correct element", "Template" -> TemplateObject[
{StringForm["The element with group `` and period `` is ", #elem["Group"], #elem["Period"]], TemplateSlot[1]}]
, "Choices" -> alkali|>], AssessmentFunction[{#elem} -> 1]]&]chemtest[]See Also
QuestionObject QuestionInterface TemplateObject
Question Interface Types: TextCompletion SelectCompletion DragCategorize MultipleShortAnswers
Comparison Methods: Expression