Text Project

To import annotations to a Text Project, you need to import a JSON file of the annotations.

The annotations JSON in Text Project contains four main fields: metadata, instances, tags, and freeText.

{
    "metadata": {},
    "instances": [],
    "tags": [],
    "freeText": ""
}

🚧

The fields that are marked in bold in the descriptions are mandatory.

Metadata

{
    "name": "example1.txt",
    "url": "string"
 }

Description:

  • "name": “string” - Document name as stated in the CSV file or generated by SDK.
  • “url”: “string” - The URL from the attached CSV.
  • "status": “string” - The document status. It can be: NotStarted, InProgress, QualityCheck, Returned, Skipped, or Completed.
  • “projectId”: "integer" - The project ID.
  • "annotatorEmail": “string” - The assigned annotator’s email address.
  • "qaEmail": “string” - The assigned QA’s email address.
  • "lastAction": objects - The user who last made changes to an instance.
    • "email": “string” - The email address of the last user who made the changes.
    • "timestamp": "integer" - The date and time when the last change was made. Format example: "timestamp": “1626152220563”

📘

  • The object name is mandatory.
  • If the object lastAction exists, then the email and timestamp are mandatory.

Instances

Entity

[
    {
      "id": "1f3e90aa-6f5f-4578-9e29-9ea89ddae38f",
      "type": "entity",
      "classId": 5005974,
      "className": "Spam",
      "start": 562,
      "end": 634,
      "attributes": [
        {
          "name": "first",
          "groupName": "Type"
        }
      ]
    }
]

Description:

  • “id”: string - Unique instance ID.
  • “type”: string - Instance type. If it’s entity, then the instance is an annotation. If it’s tag, then the instance is a tag.
  • “classId”: integer - Class ID (A class ID from the “classes.json” belonging to the instance’s corresponding class, or -1 if the instance is not classified).
  • “className”: string - Class name (one of the class names in “classes.json”).
  • “start”: number - The index of the instance’s first character. The index of the first character is 0.
  • “end”: number - The index of the instance’s last character.
  • “attributes”: array of objects - List of attributes for the instance.
    • “id”: "integer" - Attribute ID (must be in “classes.json”)
    • “groupId”: integer - Attribute group ID (must be in “classes.json”)
    • "name": string - Attribute name
    • "groupName": string - Attribute group name
  • “creationType”: string - The way in which the instance was created. Currently, only Manual is the available option.
  • "createdBy": objects
    • "email": string - The email address of the user who created the instance.
    • "role": string - The role of the user who created the instance.
  • "createdAt": string - The date and time when the instance was created.
  • "updatedBy": objects
    • "email": string - The email address of the user who updated the instance.
    • "role": string - The role of the user who updated the instance.
  • "updatedAt": string - The date and time when the instance was updated.

📘

  • If the objects createdBy and updatedBy exist, then email and role are mandatory.
  • The fields start and end are mandatory.
  • If the array attributes exists, it can be either empty or it can contain objects with the following fields: name and groupName.

Tags

[
    {
      "type": "tag",
      "classId": 5005974,
      "className": "Spam",
      "attributes": [
        {
          "name": "first",
          "groupName": "Type"
        }
      ]
    }
]

Description:

  • “type”: string - Instance type. If it’s entity, then the instance is an annotation. If it’s tag, then the instance is a tag.
  • “classId”: integer - Class ID (one of the class IDs in “classes.json”)
  • “className”: string - Class name (one of the class names in “classes.json”).
  • “attributes”: array of objects - List of attributes for the instance.
    • “id”: "integer" - Attribute ID (must be in “classes.json”)
    • “groupId”: integer - Attribute group ID (must be in “classes.json”)
    • "name": string - Attribute name
    • "groupName": string - Attribute group name
  • “creationType”: string - The way in which the instance was created. Currently, only Manual is the available option.
  • "createdBy": objects
    • "email": string - The email address of the user who created the instance.
    • "role": string - The role of the user who created the instance.
  • "createdAt": string - The date and time when the instance was created.
  • "updatedBy": objects
    • "email": string - The email address of the user who updated the instance.
    • "role": string - The role of the user who updated the instance.
  • "updatedAt": string - The date and time when the instance was updated.

📘

  • If the objects createdBy and updatedBy exist, then email and role are mandatory.
  • If the array attributes exists, it can be either empty or it can contain objects with the following fields: name and groupName.

Tags

[
        "Spam",
        "Non-Spam"
]

Description:

  • "Tag": string - The names of the tags that are added to the document.

Free text tag

"freeText": "the document describes residency"

Description:

  • "freeText": string - The text entered in the Free Text section in the editor.

Relationships

        {
            "type": "entity",
            "id": "b72c2acb-70f9-46a8-b4c4-5600068e26f3",
            "start": 118,
            "end": 161,
            "className": "City",
            ...,
        },
          {
            "type": "entity",
            "id": "9571f701-daa1-48d9-9102-c5db89e2815e",
            "start": 176,
            "end": 231,
            "className": "Country",
            ...,
          },
          {
            "type": "relationship",
            "id": "31d3c85a-9041-4ae3-a798-8dd790277144",
            "from": "b72c2acb-70f9-46a8-b4c4-5600068e26f3", //Subject entity
            "to": "9571f701-daa1-48d9-9102-c5db89e2815e", //Object entity
            "classId": 5005974,
            "className": "Capital",
            "attributes": [
                {
                    "id": 9251325,
                    "groupId": 4403072,
                    "name": "Central",
       	   	        "groupName": "Location"
                },
            ],
            "creationType": "Manual",
            "createdAt": "2023-07-24T13:11:28.831Z",
            "createdBy": {
                "email": "[email protected]",
                "role": "Annotator"
            },
            "updatedAt": "2023-07-24T13:11:28.831Z",
            "updatedBy": {
                "email": "[email protected]",
                "role": "Annotator"
            }
        }

Description:

  • “type”: string - Instance type. If it’s entity, then the instance is an annotation. If it’s relationship, then the instance is a relationship.
  • “classId”: integer - Class ID (A class ID from the “classes.json” belonging to the instance’s corresponding class, or -1 if the instance is not classified).
  • "from": string - The ID of the subject entity, where the relationship starts.
  • "to": string - The ID of the object entity, where the relationship ends.
  • "className": string - Class name (one of the class names in “classes.json”, or an empty value if the instance is not classified).
  • “attributes”: array of objects - List of attributes for the instance.
    • “id”: "integer" - Attribute ID (must be in “classes.json”)
    • “groupId”: integer - Attribute group ID (must be in “classes.json”)
    • "name": string - Attribute name
    • "groupName": string - Attribute group name
  • “creationType”: string - The way in which the instance was created. Currently, only Manual is the available option.
  • "createdBy": objects
    • "email": string - The email address of the user who created the instance.
    • "role": string - The role of the user who created the instance.
  • "createdAt": string - The date and time when the instance was created.
  • "updatedBy": objects
    • "email": string - The email address of the user who updated the instance.
    • "role": string - The role of the user who updated the instance.
  • "updatedAt": string - The date and time when the instance was updated.