Skip to main content

TextCollectionAttachment

An array of TextCollectionAttachment objects to be labeled.

Video Support

The video attachment should have content that is a link. Supported media types are listed on the MDN Web Docs.

HTML Support in TextCollection Attachments:

When creating a task in TextCollection, customers are able to pass Markdown as the string content. Markdown also allows the use of HTML tags within the Markdown syntax. However, to ensure the security of the TextCollection platform, we sanitize all HTML tags passed within the Markdown syntax using the HTML-sanitize JavaScript package. This package removes all tags except for the specific set of allowed HTML tags mentioned on the table to the right. By allowing only these specific HTML tags to be passed through the string, we ensure that the content displayed to the tasker is secure and adheres to our standards. Any HTML tags that are not included in the list of allowed tags will be removed from the string during the sanitization process. By sanitizing the HTML tags, we prevent any potential security risks that could arise from the use of unauthorized HTML tags, and maintain a high level of security on our platform. HTML tags allowed:

UnitField

UnitField objects define simple components for data collection.

Conditional Fields

Sometimes a field should only be presented if specific choices are selected for other fields. In these cases, you can specify the conditions — the dependent questions and corresponding sets of choices. The conditions property should have the following structure: an array of objects, which define one set of conditions allowing the field to be shown. The operators AND (\{ \}), OR (\[ \]), and NOT (not) are supported, so you could specify an arbitrary set of fields and choices. Each set may contain objects or arrays with the following:
  • Key: the field_id of the dependent field
  • Value: an object specifying the desired choices for the dependent field.
For example conditions, please check out the code on the right. Conditions currently only work with dependent fields of type CategoryField. It is valid syntax on other fields, but may raise errors or undefined behavior.

object
string
required
One of text, boolean, number, datetime, or category, select, time_range.
string
required
A unique identifier for the field, which should not change among tasks within a project.
string
required
Field title to be displayed to taskers. This should be short and singular. This may change among tasks within a project. Must not be an empty string.
string
A brief description about what the response should be. This may change among tasks within a project.
string
Longer explanation of why the field exists and how it should be used. Renders as a tooltip.
boolean
Determines whether or not a response for this field is required. The default is false.
integer
The minimum number of separate annotations allowed for this field. Must be larger than 0. The default is 1.
integer
The maximum number of separate annotations allowed for this field. Must be larger than or equal to min_responses_required, with an upper bound of 100. The default is 1.
array of objects
A set of conditions which must be satisfied for this field to be shown. Default is undefined.
object

TextField

Subclass of UnitField and returns a string response.

object
integer
The maximum number of characters allowed in the field.
boolean
To display word count in text fields, we can include show_word_count = true in the text field’s object.
boolean
To enable a markdown preview for the text field, we can include show_markdown_preview = true in the text field’s object.
integer
To enable maximum word counts to a specific text field, we can include max_tokens = 1000 to set the maximum words in a text response to be 1000 words.
integer
To enable minimum and maximum word counts to a specific text field, we can include min_tokens = 100 to set the minimum words in a text response to be 100 words.
boolean
To disable copying and pasting to a specific text field, we can include disable_pasting = true.

BooleanField

Subclass of UnitField and returns a boolean response. Has no additional parameters.

NumberField

Subclass of UnitField and returns a string response based on the annotated number.
object
boolean
Set to true to use a slider instead of textbox.
float
Sets the minimum value of the slider.
float
Sets the maximum value of the slider.
float
Sets the step value of the slider.
string
A string label for the lowest numerical value response.
string
A string label for the greatest numerical value.
string
A string label for the middle numerical value.

DatetimeField

Subclass of UnitField and returns a DatetimeAnnotation response.

Definition: DatetimeSpec

An enum that consists of year, month, day, hour, and minute.

Definition: DatetimeAnnotation

An interface that contains optional number fields including year, month, day, hour, and minute.
object
array of objects
required
An array of DatetimeSpec elements. Must contain at least one element.

CategoryField

Subclass of UnitField and returns an array of selected CategoryChoiceValue elements in its response. CategoryChoice elements with subchoices are only used for navigation. The only selectable CategoryChoice elements are those with no subchoices.
object
array of objects
required
An array of CategoryChoice elements to define the relevant choice.
integer
Minimum number of choices to select.
integer
Maximum number of choices to select. If this value is greater than 1, the form renders a checkbox. Otherwise, it renders a radio button.
object
string
required
The label of the choice field. This description may change among tasks within a project.
array of objects
The value of the choice field. Must be a string, number, or boolean.
string
The tooltip text shown for this choice.
array of objects
An array of CategoryChoice elements to define the relevant subchoices.

TimerangeField

Subclass of UnitField.
object
array of integers
required
Must have length 2, and be in range [0, 24 * 60 * 60]
integer
Must be between 1 and 60 * 60
string
Must be a valid field_id

SelectField

Subclass of UnitField.
object
array of objects
An array of selectable options, choices is not required if choices_from_field is present.
string
Must be a valid field_id

RankingField

RankingField objects allow you to define task to rank task attachments. Returns a list response with ordered options.
object
string
A brief description about what the response should be. This may change among tasks within a project.
string
An array of child UnitField and FieldSet objects. Must contain at least 2 elements.
string
Determines whether or not all.
string

integer
The number of options required to rank (can be less than number of attachments).
boolean
Determines whether or not all num_items_to_rank fields should filled.

FormField

FormField objects allow you to create several mini-forms associated with different attachments. These mini-forms will be populated by the object’s child fields. Returns a dictionary response with key-value pairs defined by its child fields.
object
string
required
For FormField Objects, this should be set to form
string
required
A unique identifier for the field, which should not change among tasks within a project.
string
required
Field title to be displayed to taskers. This should be short and singular. This may change among tasks within a project.
string
A brief description about what the response should be. This may change among tasks within a project.
array of objects
required
An array of child UnitField and FieldSet objects. Any FieldSet objects here must have incline set to true

📘Note

FormField objects can only be located on the top level of the fields task parameter. If one FormField object is used, all the other top-level objects must also be FormField objects.

Text Collection Response Format

The response object, which is part of the callback POST request and permanently stored as part of the task object, will have an annotations field. The annotations object is a dictionary in which each key is a field_id defined in the task parameters and each value is the respective annotation for that field. Each annotation will be of the type defined by its field above. If max_responses_required is applicable and greater than 1, the annotation will be an array of the type.

📘Note

See the Callback section for more details about callbacks.

Text Collection Hypothesis

When creating a textcollection task, you can provide prelabels in the hypothesis field, so that workers don’t have to start from scratch to annotate the image. In order to add pre-labels in a task using hypothesis, you’ll need to provide these in the hypothesis field of the payload when creating the task. The schema of the hypothesis object must match the schema of the task response.
  1. Verify the task response field schema for the desired task type.
  2. Review your project taxonomy (label names, attribute conditions, annotation types, etc).
  3. Generate pre-labels that are formatted to match the aforementioned schema and taxonomy.
  4. Create a task, including a hypothesis field that contains the pre-labels at the same top-level as other task fields such as project and instructions.
The hypothesis format will largely mirror Scale’s task response format. In this particular task type, annotations field is mandatory inside the hypothesis object. The only difference between hypothesis and the response format is that inside every field you want to pre-annotate, you’ll need to add two more field fields: type describes the field type (category, select, text, etc.)
field_id describes the identification given to this field for tracking (field name)
You can find these two fields in your task taxonomy Note: For Text types fields the response format differs from the other types. For this particular field type, response field will be an array of a single string instead of an array of arrays containing strings.

NamedEntityRecognitionLabel


NamedEntityRecognitionLabel objects define the taxonomy of labels to use to annotate spans of text.
object
string
required
A unique identifier for this label.
string
An alias for this label to display to taskers.
string
A description of what this label should represent. Displayed to taskers to improve quality.
array of objects
An array of NamedEntityRecognitionLabel objects to group underneath this label. Specifying this field causes this label itself to no longer be used for labeling text spans.
object

NamedEntityRecognitionAttribute objects define form fields for individual annotations.
object
string
Only ‘select’ for now.
array of objects
List of select option objects.
string
Optional display name.
string
Optional description.
AttributeSelectOption objects define possible values for select attributes.
object
string
The value that will show up in the response if this option is selected.
string
Optional display name if different from the value.

NamedEntityRecognitionRelationshipDefinition


NamedEntityRecognitionRelationshipDefinition objects specify the types of relationship that can exist between two text spans.
A relationship can either be named or unnamed. A named relationship is useful if you need to distinguish between multiple types of relationship that could exist between the same two text spans. For instance, if you’re annotating a description of someone’s family history, you might want to distinguish a “child of” relationship from a “sibling of” relationship. A task can only specify one type of relationship. Either all the relationships in a task must be named, or all must be unnamed.
object
string
A unique identifier for this type of relationship. Required for named relationships; disallowed for unnamed relationships.
string
A description for this relationship to display to taskers. Should be able to be used to construct a short phrase describing the relationship. For example, a relationship between two text spans “A” and “B” with display_name “is parent of” would be rendered to taskers as “A is parent of B”. Required for named relationships; disallowed for unnamed relationships.
boolean
A field indicating whether the directionality of this relationship matters. For example, a “is parent of” relationship would likely be directed, whereas a “is sibling of” relationship would likely not be directed. Optional for named relationships; disallowed for unnamed relationships.
string
A string referencing the name field of a NamedEntityRecognitionLabel object. If set, mandates that the source text span of this field must be labeled with the corresponding NamedEntityRecognitionLabel, or one of its children. Optional for both named and unnamed relationships.
string
A string referencing the name field of a NamedEntityRecognitionLabel object. If set, mandates that the target text span of this field must be labeled with the corresponding NamedEntityRecognitionLabel, or one of its children. Optional for both named and unnamed relationships.

Named Entity Recognition Callback Format

The response object is part of the callback POST request and is permanently stored as part of the task object. NamedEntityRecognitionResponse** ** The structure of a response object for named entity recognition consists of two arrays: one for entity annotations and another for relationships between these entities. NamedEntityRecognitionAnnotation** ** The format for an individual entity annotation within the named entity recognition response, detailing the unique identifier, position, and content of the recognized text span, as well as its label and any optional attributes. NamedEntityRecognitionRelationship In tasks with undirected relationships, the source_ref and target_ref fields are interchangeable. In tasks with links that do not have relationship names, the name field will be left blank.
NamedEntityRecognitionResponse NamedEntityRecognitionAnnotation NamedEntityRecognitionRelationship