"DragCategorize" (Question Interface Type)
"DragCategorize"
presents items for grouping into categories.
Properties
- In a drag-categorize question, each item must be assigned to one category, but multiple items can be placed in each category.
- In QuestionInterface["DragCategorize",props], props is an Association that supports the following keys:
-
"Prompt" None text asking the user a question "Categories" required list containing categories to display "Choices" required list with items to categorize "Labels" None list with corresponding labels for each choice "ChoiceStyle" None style to be applied to the list of choices "DefaultZoneSize" 0.2 relative size of the interface outside of the categories - "Choices" should have the form {choice1,choice2,choice3,…}.
- "Categories" should have the form {category1,category2,category3,…}.
- If not given in props, the "Choices" and "Categories" are automatically inherited from the AssessmentFunction.
Corresponding AssessmentFunction
- "DragCategorize" is not an automatically assigned interface type for any AssessmentFunction. It must be specified in QuestionInterface.
- The AssessmentFunction will receive answers in the form AssessmentFunction[…][{ch1cat1,ch2cat2,…}]. Any assessment that accepts values of this form is supported.
- When it is acceptable for the user to leave choices uncategorized, a standard AssessmentFunction structure is:
- AssessmentFunction[{patt1<|"Category"cat1|>,patt2<|"Category"cat2|>,…},<|"ListAssessment""SeparatelyScoreElements"|>]
Examples
open all close allBasic Examples (3)
A drag-categorize question for sorting items into groups:
QuestionObject[QuestionInterface["DragCategorize", "Categorize the primates"], AssessmentFunction[{
"Chimpanzee" -> <|"Category" -> "Ape"|>, "Gibbon" -> <|"Category" -> "Ape"|>,
"Baboon" -> <|"Category" -> "Monkey"|>,
"Sifaka" -> <|"Category" -> "Lemur"|>}, <|"ListAssessment" -> "SeparatelyScoreElements"|>]]A drag-categorize question with assessment performed separately on each element and allowing elements to be left uncategorized:
QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Categorize as many exercises as you can:"|>], AssessmentFunction[{"Running" -> <|"Category" -> "Aerobic"|>, "Swimming" -> <|"Category" -> "Aerobic"|>, "Weightlifting" -> <|"Category" -> "Anaerobic"|>, "Interval Training" -> <|"Category" -> "Anaerobic"|>}, <|"ListAssessment" -> "SeparatelyScoreElements"|>]]Create a drag-categorize question without assessment:
QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Classify the following musical genres according to your preferences", "Choices" -> {"Rock", "Pop", "Jazz", "Metal"}, "Categories" -> {"😁", "🙂", "🫤", "😔", "🤢"}|>]]Scope (1)
A drag-categorize question with labels for choices:
QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Classify the animals into their corresponding categories", "Labels" -> (ImageResize[#, 80]& /@ {Entity["TaxonomicSpecies", "Strigiformes::5v684"][EntityProperty["TaxonomicSpecies", "Image"]], Entity["TaxonomicSpecies", "FelisCatus::ddvt3"][EntityProperty["TaxonomicSpecies", "Image"]],
Entity["TaxonomicSpecies", "Elasmobranchii::yd8b7"][EntityProperty["TaxonomicSpecies", "Image"]],
Entity["TaxonomicSpecies", "Passeridae::f75y5"][EntityProperty["TaxonomicSpecies", "Image"]]})|>], AssessmentFunction[{"owl" -> <|"Category" -> "Bird"|>, "cat" -> <|"Category" -> "Mammal"|>, "shark" -> <|"Category" -> "Fish"|>,
"sparrow" -> <|"Category" -> "Bird"|>}, <|"ListAssessment" -> "SeparatelyScoreElements"|>]]Applications (2)
Create a question generator for a drag-categorize question:
gen = QuestionGenerator[{"ints" :> RandomInteger[100, 10]}, QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Classify the numbers:"|>], AssessmentFunction[Table[(i -> <|"Category" -> If[PrimeQ[i], "Prime", "Composite"]|>), {i, #ints}], <|"ListAssessment" -> "SeparatelyScoreElements"|>]]&]gen[]Create a QuestionGenerator for a chemistry test:
chemtest = QuestionGenerator[{"elements" :> RandomSample[EntityList@EntityClass["Element", "Nonmetal"], 5]}, QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Classify the chemical elements in their corresponding groups"|>], AssessmentFunction[MapThread[#1 -> <|"Category" -> #2|>&, {EntityList@#elements, EntityValue[#elements, "Series"]}], <|"ListAssessment" -> "SeparatelyScoreElements"|>]]&]chemtest[]Possible Issues (1)
By default, an AssessmentFunction does not expect a list of items:
QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Which of these exercises are aerobic/anaerobic?"|>], AssessmentFunction[{"Running" -> <|"Category" -> "Aerobic"|>, "Swimming" -> <|"Category" -> "Aerobic"|>, "Weightlifting" -> <|"Category" -> "Anaerobic"|>, "Interval Training" -> <|"Category" -> "Anaerobic"|>}]]Set "ListAssessment""SeparatelyScoreElements" to handle multiple items in the assessment:
QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Which of these exercises are aerobic/anaerobic?"|>], AssessmentFunction[{"Running" -> <|"Category" -> "Aerobic"|>, "Swimming" -> <|"Category" -> "Aerobic"|>, "Weightlifting" -> <|"Category" -> "Anaerobic"|>, "Interval Training" -> <|"Category" -> "Anaerobic"|>}, <|"ListAssessment" -> "SeparatelyScoreElements"|>]]Neat Examples (1)
englishtest = QuestionGenerator[{"words" :> RandomWord[8]}, QuestionObject[QuestionInterface["DragCategorize", <|"Prompt" -> "Categorize the words based on their respective parts of speech.", FontSize -> 15|>],
AssessmentFunction[
Flatten[Thread[# -> Table[<|"Category" -> part|>, {part, PartOfSpeech[#]}]]& /@ #words], <|"ListAssessment" -> "SeparatelyScoreElements"|>]]&]englishtest[]See Also
QuestionObject QuestionInterface GroupBy
Question Interface Types: DragCompletion SelectPair MultipleChoiceGrid MultipleChoice
Comparison Methods: Expression