Skip to main content

Classification Human Task

Classification Human Task

Classification Human Task is used to assign a document to one or more classes or categories.

Classification Human Task can be configured for Single Label Classification (1 document relates only to one category) or Multi-Label Classification (1 document may relate to multiple categories)

Classification Human Task can be utilized for:

  • Saving and processing category classified by a human in Automation Process
  • Collecting Training Set for Machine Learning model training
  • Verification of data extracted by Machine Learning model

Document Type JSON Structure

Below you can find an example of the Settings JSON for the Sample Classification Task:

Classification Document Type JSON example
{
	"appLanguage": "en",
	"multipleChoice": true,
	"taskInstructionText": "Read the document carefully and classify using the categories provided.",
	"taskInstructionLink": "",
	"taskTypeLabel": "Document classification",
	"metadata": [
		{
			"name": "input_custom_error_1",
			"type": "input",
			"label": "Input with custom error",
			"validationRegExp": "^[a-zA-Z]+$",
			"errorMessage": "Example of custom error"
		},
		{
			"name": "datepicker_5",
			"label": "format D MMM YYYY",
			"type": "date",
			"format": "D MMM YYYY"
		},
		{
			"name": "datepicker_4",
			"label": "format MMMM DD",
			"type": "date",
			"format": "MMMM DD"
		},
		{
			"name": "datepicker_3",
			"label": "keyboard format YYYY",
			"type": "date",
			"keyboard": true,
			"format": "YYYY"
		},
		{
			"name": "datepicker_2",
			"label": "keyboard format MM-DD-YYYY",
			"type": "date",
			"keyboard": true,
			"format": "MM-DD-YYYY"
		},
		{
			"name": "datepicker_1",
			"label": "keyboard format MM.DD.YYYY",
			"type": "date",
			"keyboard": true,
			"format": "MM.DD.YYYY"
		},
		{
			"name": "select_multiple_1",
			"type": "select",
			"required": true,
			"multiple": true,
			"label": "Multiple Select",
			"items": [
				"string_1",
				"string_2",
				"string_3"
			]
		},
		{
			"name": "select_2",
			"type": "select",
			"required": true,
			"label": "Single Select",
			"items": [
				{
					"value": "real_value_1",
					"label": "label_1"
				},
				{
					"value": "real_value_2",
					"label": "label_2"
				},
				{
					"value": "real_value_3"
				}
			]
		},
		{
			"name": "autocomplete_multiple_1",
			"type": "select",
			"required": true,
			"multiple": true,
			"autocomplete": true,
			"label": "Multiple Autocomplete",
			"description": "Description for Autocomplete",
			"items": [
				"string_1",
				"string_2",
				"string_3"
			]
		},
		{
			"name": "autocomplete_2",
			"type": "select",
			"required": true,
			"autocomplete": true,
			"label": "Single Autocomplete",
			"items": [
				{
					"value": "real_value_1",
					"label": "label_1"
				},
				{
					"value": "real_value_2",
					"label": "label_2"
				},
				{
					"value": "real_value_3"
				}
			]
		},
		{
			"name": "checkbox_1",
			"type": "checkbox",
			"markLabel": "Checkbox Label",
			"label": "Single Checkbox"
		},
		{
			"name": "input_with_mask_1",
			"type": "input",
			"label": "Input with mask",
			"mask": "+7 (999) 999-99-99"
		},
		{
			"name": "input_with_mask",
			"type": "input",
			"label": "Example of a mask characters escape",
			"mask": "+4\9 99 999 99"
		},
		{
			"name": "number_input_1",
			"type": "number_input",
			"label": "Number Input Example"
		},
		{
			"name": "textarea_1",
			"type": "textarea",
			"label": "Text Area minRows: 5 maxRows:8",
			"minRows": 5,
			"maxRows": 8
		},
		{
			"name": "checkbox_group_1",
			"type": "checkbox_group",
			"label": "Checkbox Group String Values",
			"description": "Description for checkbox group",
			"items": [
				"string_1",
				"string_2",
				"string_3"
			]
		},
		{
			"name": "radio_group_1",
			"type": "radio_group",
			"required": true,
			"label": "Radio Group",
			"description": "Description forradio group",
			"items": [
				{
					"value": "real_value_1",
					"label": "label_1"
				},
				{
					"value": "real_value_2",
					"label": "label_2",
					"disabled": true
				},
				{
					"value": "real_value_3"
				}
			]
		},
		{
			"type": "info",
			"label": "Text info with paragraphs",
			"text": [
				"Donec neque elit, mattis nec urna ac, ullamcorper sagittis nibh. Donec nec maximus ipsum. Quisque consequat mauris arcu, et porta ligula sollicitudin a. Cras vitae sodales lectus. Nunc turpis nisl, cursus cursus lacus non, sollicitudin iaculis eros. Donec nibh erat, scelerisque non dui eu, aliquet pulvinar felis..",
				"Etiam ultrices turpis nulla, eu vestibulum quam ultricies quis. Nullam vel lacus scelerisque, semper ante id, dapibus augue. Pellentesque id nisl id tellus rutrum consequat a pretium eros. Integer lacinia odio non est aliquet consectetur. Cras id lacus sit amet orci suscipit fermentum ac nec lorem. Donec et mauris ut enim semper porta."
			]
		},
		{
			"type": "info",
			"label": "Text Info",
			"text": "Donec neque elit, mattis nec urna ac, ullamcorper sagittis nibh. Donec nec maximus ipsum. Quisque consequat mauris arcu, et porta ligula sollicitudin a. Cras vitae sodales lectus. Nunc turpis nisl, cursus cursus lacus non, sollicitudin iaculis eros. Donec nibh erat, scelerisque non dui eu, aliquet pulvinar felis. Nam rhoncus libero in magna aliquet, eget rutrum magna dictum. Pellentesque molestie turpis fermentum vulputate mattis."
		}
	],
	"categories": [
		"Water",
		"Recycling",
		"Electricy",
		"Gas",
		"Telecom"
	],
	"labels": {
		"Water": "Water label",
		"Gas": "Gas label"
	},
	"scoreThreshold": 0.1
}

These settings contain:

  • autoSave (boolean) (optional) - allows saving intermediate task results automatically. By default, the setting has a "false" value. 
  • taskInstructionText (string) (optional) - represents the instructions text that will appear in the popup
  • taskInstructionLink (string) (optional) - represents the link to the remote instructions source. Having at least one of these fields taskInstructionText or taskInstructionLink will cause the Instructions button to appear.
  • taskTypeLabel (string) (optional) - allows to configure the task title. By default, it is set to "Document Classification".
  • appLanguage (string) (optional) -  allows the user to set up the Human Task localization. Currently available options are "en" and "ru". By default, the task displays as "en".  
  • multipleChoice (boolean) (optional) - allows enabling multiple choice mode, where you can select multiple categories instead of one. By default, the setting has a "false" value. 
  • commentsSectionName (string) (optional) - is used to rename the "More" tab. By default, the setting has a "More" value. 
  • categories (list of strings) (required) - list of predefined classes your documents may relate to
  • labels (map) (optional) - map where key is one of classes from categories array and value is used to set displayed name for this class. If no label presented displayed name will be set from class.
  • scoreThreshold (decimal) (optional) - is used when multipleChoice is true to auto-select the categories after ML. When multipleChoice is false, the scoreThreshold doesn't matter because the category with the highest score is automatically selected.
  • metadata (list of objects) (optional) - is used to configure the "More" tab in Workspace and Document view in Document sets. The "More" tab is disabled if metadata is not defined. Checkbox "Invalid Document" on the "More" tab can be configured, but cannot be removed. If checkbox "Invalid Document" is checked all validations will be disabled.

Default "Invalid Document" checkbox can be customized using the settings below:

    • name (string) (required) - is used to declare the section that is used to configure the name and description of the "Invalid Document" checkbox. The default value is "isInvalid" and it cannot be changed, if changed the markLabel and description settings will have the default values.
    • markLabel (string) (optional) - is used to define the name of the default checkbox in the "More" tab. By default, the setting has an "Invalid Document" value.
    • description (string) (optional) - allows to add the description to default "Invalid Document" checkbox. By default, the description is not displayed.

Additional fields can be added to the "More" tab using the settings below:

    • name (string) (required) - it serves as a key to receiving data from "More" tab from Human Task output. Required for the following types: input, number_input, textarea, date, radio_group, select, checkbox, checkbox_group, date.
    • label (string) (optional) - is used to set a name for a field.
    • type (string) (required) - specifies the type of field. Should be one of the supported types: input, number_input, textarea, date, radio_group, select, checkbox, checkbox_group, info, date.
    • required (boolean) (optional) - shows if the field is required for filling in the "More" tab, so human won't be able to submit Human Task without specifying the values for all required fields in the "More" tab except the case when the checkbox "Invalid Document" is checked.
    • multiple (boolean) (optional) - is used only if "type": "select". Allows to select multiple items in the select dropdown list. Can work with autocomplete setting.
    • autocomplete (boolean) (optional) - is used only if "type": "select". Allows to search by items in the select dropdown list. Can work with multiple setting.
    • mask (string) (optional) - is used only if "type": "input". Allows to set a string of characters that indicates the format of valid input values. Default format characters: "9" for 0-9 characters; "a" for A-Z and a-z characters; "" for A-Z, a-z, 0-9 characters. If required to have exactly "9" character (e.g., a phone code), use "\" before the character (e.g., "+4\9 99 999 99"). If "required": true and a mask are set for "type": "input", input must be filled completely according to the mask.
    • minRows (number) (optional) - is used only if "type": "textarea". Specifies the minimum number of lines to display in the textarea. By default, the setting has the value "2". 
    • maxRows (number) (optional) - is used only if "type": "textarea". Specifies the maximum number of lines to display in the textarea without a scroll appearing. If the number of rows is not within maxRows setting, a scroll appears. There is no default value and the field grows without limit.
    • disabled (boolean) (optional) - provides the possibility to disable the field which will prevent the user from filling this field.
    • validationRegExp (string) (optional) - provides possibility to validate filled values using regular expressions.
    • description (string) (optional) - allows to add a description to a field. Can be added for the following types: input, number_input, textarea, date, radio_group, select, checkbox, checkbox_group, date.
    • errorMessage (string) (optional) - is used to set the text for the error if the filled values do not match the regular expression in validationRegExp setting.
    • items (list of objects) (required only for "type": "checkbox_group", "radio_group", "select") - is used only if "type": "checkbox_group", "radio_group","select". Specifies possible items to check. Each item in the list has the following properties: 
      • value (string) (required) - the value of the item to display.
      • label (string) (optional) - the label of the item to display. If no label is set, value is displayed instead. If both settings are set, label is displayed on Human Task, but value is set in Human Task Output.
      • disabled (boolean) (optional) - provides the possibility to disable the item which will prevent the user from selecting it.
    • markLabel (string) (optional) - is used only if "type": "checkbox". Displays the label of the checkbox.
    • text (string or array) (optional) - is used only if "type": "info". Displays uneditable text for info field. If the text contains an array of strings, each string will be considered as a new paragraph.
    • keyboard (boolean) (optional) - is used only if "type": "date". Allows to enable manual date entry for datepicker form. By default, the setting has the value "false".
    • format (string) (optional) - is used only if "type": "date". Allows to set a custom date format. By default, the setting has a "MM/DD/YYYY" value. Supports the following formatting tokens for dates:


      TokenOutput
      MonthM1 2 ... 11 12

      MM01 02 ... 11 12

      MMMJan Feb ... Nov Dec

      MMMMJanuary February ... November December
      Day of MonthD1 2 ... 30 31

      DD01 02 ... 30 31
      YearYY70 71 ... 29 30

      YYYY1970 1971 ... 2029 2030

Input JSON Structure

The input for Classification Human Task is a JSON with a structure based on the type of document to be processed:

Input JSON for processed PDF files (Classification Task)

Represents the document's OCR result in JSON format superimposed on the original document picture. It is generated automatically during OCR preprocessing:

Input JSON example for PDF documents
{
	"images": [ // There should be an array to support multipage PDFs. Each page should be defined individually in this case.
		{
			"content": "https://some-provider.com/img.jpg",
			"tessinput": "https://some-provider.com/tessinput.jpg"
			"json": <OCR-JSON>,
			"dimensions": { // The dimensions of the page in pixels.
				"width": 2000,
				"height": 3000
			}
		}
	]
}

Input JSON contains:

    • images (list of objects) - the root element containing a list of document configurations. The list usually contains only one element.  
      • content (url or base64 string) - the source of the input document to display. It may be an URL to a document or the document's content encoded in base64 (e.g. the string value "data:image/jpg;base64,R0lGOD....").
      • json (OCR-JSON object) - provides OCR information. OCR-JSON structure is described below.
      • dimensions (object) - an object contains "width" and "height" parameters which represent the width and height of the original input document.
        • width (integer) - width value of original input document.
        • height (integer) - height value of original input document.

OCR-JSON object has the following structure which is generated by the OCR component by itself:

OCR-JSON
"json": {
	"pages": [
		"id": "page0",
		"areas": [
			{
				"id": "page0_area0",
				"paragraphs": [
					{
						"id": "page0_area0_paragraph0",
						"lines": [
							{
								"id": "page0_area0_paragraph0_line0",
								"words": [
									{
										"id": "page0_area0_paragraph0_line0_word0",
										"text": "Advanced",
										"properties": {
											"bbox": [
												0.05999032414126754,
												0.037290455011974,
												0.14078374455732948,
												0.046527540198426275
											],
										"x_fsize": 0,
										"x_wconf": 96
									}
								},
							}
						...
						]
					}
				]
			}
		]
	}

This JSON contains all OCRed words and is kept in a tree-like structure: pages → areas → paragraphs → lines → words

  • json (object) - root element
    • pages (list of objects) - list of pages structure. Each page in the list has the following structure:
      • id (string) - id of the page
      • areas (list of objects) - list of areas structure. Each area in the list has the following structure:
        • id (string) - id of the area
        • paragraphs (list of objects) - list of paragraphs structure. Each paragraph in the list has the following structure:
          • id (string) - id of the paragraph
          • lines (list of objects) - list of lines structure. Each line in the list has the following structure:
            • id (string) - id of the line
            • words (list of objects) - list of words structure. Each word in the list has the following structure:
              • id (string) - id of the word
              • text (string) - original text extracted by OCR engine 
              • properties (object) - property object with the following structure:
                • bbox (list of integers) - top-left and bottom-right coordinates of the rectangle around the word in the original document. Coordinates are normalized to be from 0 to 1 relative to original document size
              • x_fsize (integer) - is the OCR-engine specific font size
              • x_wconf (integer) - OCR-engine specific confidence for the entire contained substring. Higher values express higher confidence

Input JSON for text documents (Classification Task)

Represents the document's text in JSON format and has the following structure:

Input JSON example for text documents
{
	"text": [
		"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
		"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
		"It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.",
		"It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
	]
}

Input JSON for text documents contains:

  • text (list of strings) - text to classify. Adding several strings to the list will result in a text separated by paragraphs on Human Task. 

Input JSON for HTML documents (HTML Classification Task)

Represents the document's html in JSON format and has the following structure:

Input JSON example for text documents
{
	"html": "<html><head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
}

body {
padding: 50px
}

header {
display: flex;
flex-direction: column;
align-items: center;
}

header > p {
font-weight: bold;
}

.block {
margin: 30px 0;
display: flex;
justify-content: space-between;
align-items: flex-start;
}

.block > :first-child {
font-weight: bold;
}

.block_right {
font-size: 14px;
}

.section {
margin-bottom: 50px;
}

.section_title {
border: 1px solid black;
background-color: #888;
}

.section_item {
display: flex;
flex-wrap: nowrap;
margin: 3px 0;
}

.section_item > :first-child {
font-weight: bold;
width: 250px;
}
</style>
</head>
<body>
<header>
<h1>STATE OF GEORGIA</h1>
<p style="font-size: 1.5rem">Secretary of State</p>
<p>Corporations Division</p>
<p>313 West Tower</p>
<p>2 Martin Luther King, Jr.Dr.</p>
<p>Atlanta, Georgia 30334-1530</p>
</header>
<main>
<div class="block">
<p>ANNUAL REGISTRATION</p>
<div class="block_right">
<p>"Electronically filled"</p>
<p>Secretary of State</p>
<p>Filling Date: 3/12/2017 11:37:21 AM</p>
</div>
</div>
<div class="section">
<p class="section_title">BUSINESS INFORMATION</p>
<div class="section_item">
<p>CONTROL NUMBER</p>
<p>0626692</p>
</div>
<div class="section_item">
<p>BUSINESS NAME</p>
<p>"WHATS THE OCCASION?", LLC</p>
</div>
<div class="section_item">
<p>BUSINESS TYPE</p>
<p>Domestic Limited Liability Company</p>
</div>
<div class="section_item">
<p>EFFECTIVE DATE</p>
<p>03/12/2017</p>
</div>
</div>
<div class="section">
<p class="section_title">PRINCIPAL OFFICE ADDRESS</p>
<div class="section_item">
<p>ADDRESS</p>
<p>1220 TIMBERLINE PLACE, ALPHARETTA, USA</p>
</div>
</div>
<div class="section">
<p class="section_title">REGISTERED AGENT'S NAME AND ADDRESS</p>
<div class="section_item">
<p>NAME</p>
<p>ADDRESS</p>
</div>
<div class="section_item">
<p>LAUREL S. LUSBY</p>
<p>1220 TIMBERLINE PLACE, Fulton, ALPHARETTA, GA, 30005, USA</p>
</div>
</div>
<div class="section">
<p class="section_title">AUTHORIZER INFORMATION</p>
<div class="section_item">
<p>AUTHORIZER SIGNATURE</p>
<p>Laurel S Lusby</p>
</div>
<div class="section_item">
<p>AUTHORIZER TITLE</p>
<p>Manager</p>
</div>
</div>
</main>
</body></html>"
}

Input JSON for HTML documents contains:

  • html(string) - html to classify. 


Input JSON additional common settings

The following additional settings can be used in Input JSON:

  • overrides (optional) - allows overriding the field and its options from Document Type Settings if it is used as default Input. The field to be overridden should be declared in the block by its name. Then settings of the field to be overridden has to be declared and defined. Please note, that "name" and "type" cannot be overridden.

      "overrides": {
        "input_custom_error_1": {
          "label": "Overrided input with custom error"
        }
         } -  "label" for the field with the name "input_custom_error_1" will be overridden with the set value.

  • messages (optional) - allows displaying the block with a message or several messages. The block can be configured with various severity parameters: "info", "warning", "error".

    • "messages": ["Info message"] - to display the block with message "Info message" with default severity "info";
    • "messages": [{ "severity": "info", "text": "Info message" }] - to display the info message "Info message";
    • "messages": [{ "severity": "warning", "text": "Warning message" }] - to display the warning message "Warning message";
    • "messages": [{ "severity": "error", "text": "Error message" }] - to display the error message "Error message";

    • "messages": 
       [
         { 
           "severity": "error", 
           "text": "Error message" 
         }, 
         {
          "severity": "info", 

          "text": "Info message" 
         },
         {
          "severity": "warning", 

          "text": "Warning message" 
         }
       ]- to display several messages of different severity. 

Output JSON Structure

As an output Document Classification Human Task produces the following JSON:

Example of Output JSON
{
	"categories": [
		"Water",
		"Recycling"
	],
	"scores": {
		"Water": 0.511058509349823,
		"Recycling": 0.3745160043239594,
		"Electricy": 0.06,
		"Gas": 0.03,
		"Telecom": 0.02442548633
	},
	"metadata": {
		"select_multiple_1": [
			"string_1",
			"string_2"
		],
		"select_2": "real_value_1",
		"autocomplete_multiple_1": [
			"string_2",
			"string_3"
		],
		"autocomplete_2": "real_value_1",
		"checkbox_1": true,
		"radio_group_1": "real_value_1"
	}
}


It has the following structure:

  • categories (list of strings) - the categories to which the input document belongs. The result can be provided either by ML model or by a human. It is possible to have multiple values in the list if the Document Type setting has multipleChoice is true, but only 1 value if it is false.

    The category values in Human Output JSON are formed as follows for multiple classification:

    • The user's chosen category will be displayed if they selects one.
    • If the user did not select a category, categories with score values greater than scoreThershold will be displayed.
    • If the user has not selected a category and no category has a score greater than scoreThershold, the categories will be left empty.
  • scores (map) - exists only if classification results are provided by ML. Each category's score value is represented as a key-value structure, where is the key - is the category name and the value is a decimal value that represents a score from 0 to 1.
  • metadata (map) - exists only if fields from the More/renamed metadata section were filled. Represented as a key-value structure, where is the key - is the field name defined in Document Type Settings and the value is a value put in a field.