Question Answering
![](png/question-answering.png)
If you want to train a question answering machine learning model, use this template to develop a dataset. This template prompts annotators to read a passage of text, then highlight the span of text that answers a specific question.
Interactive Template Preview
Labeling Configuration
<View>
<Header value="Please read the passage" />
<Text name="text" value="$text" granularity="word"/>
<Header value="Select a text span answering the following question:"/>
<Text name="question" value="$question"/>
<Labels name="answer" toName="text">
<Label value="Answer" maxUsage="1" background="red"/>
</Labels>
</View>
About the labeling configuration
All labeling configurations must be wrapped in View tags.
You can add a header to provide instructions to the annotator:
<Header value="Please read the passage" />
Use the Text object tag to display a passage of text to the annotator:
<Text name="text" value="$text" granularity="word"/>
Use the granularity
parameter to ensure that highlighted text spans include complete words.
You can add a header to provide instructions to the annotator:
<Header value="Select a text span answering the following question:"/>
Use another Text object tag to display a second text snippet, in this case, a question about the text, to the annotator:
<Text name="question" value="$question"/>
The name
parameter must be different from the name
used for the first text snippet, and the value
is used to reference a column in a CSV file or a key in a JSON file with the text to display. You can also display static text with the value
argument.
Use the Labels control tag to provide an Answer label for the annotator to use to highlight the answer to the question in the original text passage:
<Labels name="answer" toName="text">
<Label value="Answer" maxUsage="1" background="red"/>
</Labels>