"DragCompletion" (问题界面类型)
"DragCompletion" (问题界面类型)
"DragCompletion"
提供了一个填空界面,其中包含空白位置,可以拖动选项进行填充.
属性
- Wolfram Cloud 不支持 "DragCompletion" 界面.
- 在 QuestionInterface["DragCompletion",props] 中,props 是一个 Association,支持以下键:
-
"Prompt" None 向用户提问的文字 "Template" (required) 含有可填充空白的模板对象 "Choices" Automatic 可使用的选项 "ChoiceOrdering" Automatic 对选项进行排序的函数 - "Template" 可以是 TemplateObject 或 StringTemplate 支持的任何内容. 提供字符串时,由反引号 `` 表示的模板槽将定义问题界面中空白的位置.
- 默认情况下,"Choices" 继承自 AssessmentFunction,并对其随机排序以避免暴露正确答案.
- 如果直接提供,应以 {item1,item2,…} 这种形式给出 "Choices". 默认情况下,保留原有顺序.
- 如果指定了 "ChoiceOrdering"f,则以 f[{item1,item2,…}] 提供选项.
对应的 AssessmentFunction
- "DragCompletion" 不是为 AssessmentFunction 自动分配的界面类型. 必须在 QuestionInterface 中指定.
- AssessmentFunction[{val1,…},…] 的值 vali 应按顺序包含每个填空的答案.
范例
打开所有单元 关闭所有单元基本范例 (3)
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}]]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"|>]]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"]}}]]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}]]范围 (2)
用 TemplateObject 提供模板:
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]]选项可以是任何类型的表达式. 创建选项为图像的“拖动-完成填空”问题:
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"]]属性和关系 (1)
通过设置 "ChoiceOrdering"f 指定一个用于对界面中的选项进行排序的函数:
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}]]可能存在的问题 (1)
AssessmentFunction 中的值应为列表:
QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blank", "Template" -> "apples are ``", "Choices" -> {"red", "blue", "purple"}|>], AssessmentFunction["red" -> 1]]QuestionObject[QuestionInterface["DragCompletion", <|"Prompt" -> "Fill in the blank", "Template" -> "apples are ``", "Choices" -> {"red", "blue", "purple"}|>], AssessmentFunction[{"red"} -> 1]]互动范例 (1)
为 "DragCompletion" 问题创建 QuestionGenerator:
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[]相关指南
-
▪
- 问题与评估