"TextCompletion" (Question Interface Type)
"TextCompletion"
provides a fill-in-the-blank interface with textual input fields.
Properties
- In QuestionInterface["TextCompletion",props], props is an Association that supports the following keys in addition to the options supported by InputField:
-
"Prompt" None text asking the user a question "Template" (required) string template with slots to be filled FieldSize Automatic size of input fields - The "Template" should be a string of the type used in StringTemplate. Template slots denoted by backticks `` define locations for blanks in the question interface.
- Additionally, options for InputField are supported including:
-
Background Automatic input field background color FieldHint Null expression to display when the input field is empty FieldSize {{{{5,Infinity},{1,Infinity}}}} the size of the menu field - For an InputField setting optvalue, the following forms of value are supported:
-
expr use expr for all fields {expr1, expr2, …} use the expri in order for each field, then use defaults {expr1, expr2,…,{c},exprm,…,exprn} use the sequence of expri, then repeatedly use c, then use the last sequence of expri at the end {i1->v1,i2->v2,…} specify what to use at positions ik {spec,rules} use rules to override specifications in spec
Corresponding AssessmentFunction
- "TextCompletion" is not an automatically assigned interface type for an AssessmentFunction. It must be specified in QuestionInterface.
- The values vali in AssessmentFunction[{val1,…},…] should be strings containing the answers for each slot in order.
Examples
open all close allBasic Examples (3)
Create a text completion interface without assessment:
Define a text completion question with assessment:
Create a text completion question providing a full TemplateObject:
Scope (3)
Applications (1)
Possible Issues (2)
The values in the AssessmentFunction should be lists:
Specify the values as a list instead:
The TemplateObject created by StringTemplate contains options incompatible with "TextCompletion":
Attempting to use this template will create a broken interface:
Now the template works in "TextCompletion":
Alternatively, use TemplateObject directly instead of StringTemplate:
This template does not have any options settings:
It works in "TextCompletion":
See Also
QuestionObject QuestionInterface TemplateObject
Question Interface Types: DragCompletion SelectCompletion DragCategorize MultipleShortAnswers
Comparison Methods: Expression