Comment on page
Annotations
Annotations one of the fundamental building blocks of extracted data. They say that a portion of a source has some special meaning
post
https://api.annolab.ai
/v1/annotation/create
Create Annotation
Examples of how to make an annotation create request
Python
import requests
ANNO_LAB_API_KEY = 'XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX'
annotation = {
'annoTypeIdentifier': 'Place Name',
'projectIdentifier': 'New NER Project',
'layerIdentifier': 'NER Gold',
'sourceIdentifier': 145,
'offsets': [0, 5],
'directoryIdentifier': 'Wikipedia Subset',
'value': '{latitude:"37.983810", longitude:"23.727539"}'
}
headers = {
'Authorization': 'Api-Key '+ANNO_LAB_API_KEY,
}
url = 'https://api.annolab.ai/v1/annotation/create'
response = requests.post(url, headers=headers, json=annotation)
print(response.json())
post
https://api.annolab.ai
/v1/annotation/bulk-create
Bulk Create Annotations
Examples of how to bulk create annotations
Python
import requests
ANNO_LAB_API_KEY = 'XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX'
headers = {
'Authorization': 'Api-Key '+ANNO_LAB_API_KEY,
}
bulk_request = {
'preventDuplication': True
'annotations': [
{
'annoTypeIdentifier': 'Place Name',
'projectIdentifier': 'New NER Project',
'schemaIdentifier': 'NER',
'layerIdentifier': 'NER Gold',
'sourceIdentifier': 145,
'offsets': [0, 5],
'directoryIdentifier': 'Wikipedia Subset',
'value': '{latitude:"37.983810", longitude:"23.727539"}',
'clientId': "24a"
},
{
'annoTypeIdentifier': 'Place Name',
'projectIdentifier': 'New NER Project',
'schemaIdentifier': 'NER',
'layerIdentifier': 'NER Gold',
'sourceIdentifier': 145,
'offsets': [120, 128],
'directoryIdentifier': 'Wikipedia Subset',
'value': '{latitude:"37.983810", longitude:"23.727539"}',
'clientId': "24b"
}
]
}
url = 'https://api.annolab.ai/v1/annotation/bulk-create'
response = requests.post(url, headers=headers, json=bulk_request)
An object corresponding to a single annotation
Attribute Name | Type | Description |
---|---|---|
annotationId | Integer | Unique id for the annotation |
sourceReferenceId | Integer | Unique id for the file that contains the annotation |
typeName | String | Name of the type of annotation |
value | String | By default is the text that the annotation contains (can be manually overidden) |
pageNumber | Integer | Starting page of the annotation |
endPageNumber | Integer|Null | Ending page of the annotation (if single page annotation will be null) |
offsets | Integer[] | Array describing character offsets of the annotation within the source |
textBounds | Geometry|Null | Geometry object describing the location of the text the annotation contains within the page |
imageBounds | Geometry|Null | Geometry object describing the location of the box drawn by a model or user on the page (always rectangular) |
createdBy | Integer | User id that created the annotation (or user id that invoked the model) |
updatedBy | Integer | User Id that updated the annotation |
confidence | Float | Value between 0 and 100 representing the confidence of the OCR translation of any text bounds the annotation contains.
If annotation contains multiple text bounds, will be an average of all containing texts. |
score | Float | Value between 0 and 1 representing sureness of a machine learning model in applying the annotation.
We calculate this by taking the average of the SoftMax for all tokens comprising the annotation |
layerId | Integer | Id for the layer that contains the annotation |
isReviewed | Boolean | Has the annotation been reviewed |
reviewedBy | Integer|Null | Reviewer that reviewed the annotation |
reviewedAt | DateTime|Null | Time of review |
modelSourceId | Integer | Id for the model that produced the annotation |
modelSource | String | Name of the model that produced the annotation |
{
'annotationId': 403992,
'sourceReferenceId': 12341,
'typeName': 'Grantor',
'value': ' Carsuo',
'pageNumber': 3,
'endPageNumber': null,
'offsets': [1320, 1326],
'textBounds': {'type': 'MultiPolygon', 'coordinates': [[[[0.565917551517487, 0.769474387168884], [0.609824299812317, 0.769511699676514], [0.609820425510406, 0.778583765029907], [0.565913617610931, 0.778546392917633], [0.565917551517487, 0.769474387168884]]]]},
'imageBounds': null,
'createdBy': 5,
'updatedBy': null,
'confidence': 96.7900390625,
'score': 0.7074922025203705,
'layerId': 635,
'isReviewed': False,
'reviewedBy': null,
'reviewedAt': null,
'modelSourceId': 12,
'modelSource': 'Party Name Extractor'
}
An abstract form of an annotation that is not grounded in any explicit mention or context, simplified to the components of name and value.
Attribute Name | Type | Description |
---|---|---|
name | String | The annotation type name. Must already exist as an annotation type in your project |
value | String | Canonical value describing the annotation |
{
"name": "Make",
"value": "Cessna",
}