Refonte AI

Create Text Collection Task

A text collecting task is created by this endpoint. In order to do this assignment, Refonte will gather data from the attached files and/or the internet by following your directions. Examples of use cases include asking a set of links to retrieve sentiment data or identifying structurally complex data from an attached image.

An attachments array describing the attachments to be annotated and a fields parameter describing all the various bits of information to be gathered are required for this operation.

Every object in the array with the fields parameter has a field_id, type, and title. The annotation will be returned under the field_id key, which needs to be unique inside the project. This array defines the majority of the work. It could be useful to think of creating this parameter as being like creating an HTML form. If it works, Refonte.Ai will return the produced task object right away. At that point, you can keep the task_id to have a reference to the task always.

The parameters attachments and fields will be stored in the params object of the constructed task object.

Body Params

name string required

Request

Python

POST /v1/task/textcollection
const request = require('request');

const options = {
  method: 'POST',
  url: 'https://api.refonte.com/v1/task/textcollection',
  headers: {accept: 'application/json', 'content-type': 'application/json'},
  body: {
    project: 'string',
    batch: 'string',
    instruction: '**Instructions:** Please annotate all the things',
    callback_url: 'string',
    fields: [
      {
        type: 'category',
        field_id: 'category_field',
        title: 'Please select the most relevant option',
        description: 'string',
        choices: [{label: 'Correct Website', value: 'correct_website'}]
      }
    ],
    attachments: [{type: 'website', content: 'https://www.refonte.com/'}],
    title: 'string',
    description: 'string',
    responses_required: 1,
    priority: 30,
    unique_id: 'string',
    clear_unique_id_on_error: true,
    tags: ['string']
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response

{
  "task_id": "5c3f9c25744e7d005052e319",
  "created_at": "2019-01-16T21:03:33.166Z",
  "callback_url": "http://www.example.com/callback",
  "type": "textcollection",
  "status": "completed",
  "instruction": "Find the URL for the hiring page for the company with attached website.",
  "urgency": "day",
  "attachments": [
    {
      "type": "website",
      "content": "https://www.refonte.com/"
    }
  ],
  "fields": [
    {
      "type": "category",
      "field_id": "category_field",
      "title": "Please select the most relevant option",
      "description": "string",
      "choices": [
        {
          "label": "Correct Website",
          "value": "correct_website"
        }
      ]
    }
  ],
  "metadata": {}
}

Create Named Entity Recognition Task

A new task for named entity recognition is created by this endpoint. Our labelers will read the given text and highlight any text entity mentions that match the designated labels in order to finish this assignment.

These jobs do not call for an attachment or a field called attachments with a link to the attachment that needs to be annotated, in contrast to most tasks. Rather, the text to be annotated is supplied directly in the request body's text argument.

Body Params

project string

The name of the project to associate this task with. See the Projects Section for more details.

Body Params

batch string

The name of the batch to associate this task with. Note that if a batch is specified, you need not specify the project, as the task will automatically be associated with the batch's project. For Refonte Rapid projects specifying a batch is required. See Batches section for more details.

Body Params

instructions string required

A markdown-enabled string or iframe embedded Google Doc explaining how to do the task. You can use markdown to show example images, give structure to your instructions, and more. See our instruction best practices for more details. For Refonte Rapid projects, DO NOT set this field unless you specifically want to override the project level instructions.

Body Params

callback_url string

The full url (including the scheme http:// or https://) or email address of the callback that will be used when the task is completed.

Body Params

text string required

The text from which to extract named entities.

Body Params

attachment array of integers

An array of TextCollectionAttachment objects to be labeled

Body Params

labels array of integers required

An array of NamedEntityRecognitionLabel objects containing descriptions for the text span types to label.

Body Params

relationships array of strings

An array of NamedEntityRecognitionRelationshipDefinition objects containing descriptions for the relationships between text spans to annotate.

Body Params

merge_newlines boolean

If true, removes the '\n' characters in the input and do not displays line breaks in the task interface.

Body Params

allow_overlapping_annotations boolean

If true, allows annotations to overlap. Otherwise, all annotations must cover disjoint text spans.

Body Params

unique_id boolean

A arbitrary ID that you can assign to a task and then query for later. This ID must be unique across all projects under your account, otherwise the task submission will be rejected. See Avoiding Duplicate Tasks for more details.

Body Params

clear_unique_id_on_error boolean

If set to be true, if a task errors out after being submitted, the unique id on the task will be unset. This param allows workflows where you can re-submit the same unique id to recover from errors automatically

Body Params

tags array of strings

Arbitrary labels that you can assign to a task. At most 5 tags are allowed per task. You can query tasks with specific tags through the task retrieval API.

Request

Python

POST /v1/task/textcollection
const sdk = require('api')('@refonte-ai/v1.3#20c5u82flglvwk99');

sdk.namedEntityRecognition({
  instruction: 'Highlight any **text entity mentions**
                that correspond to the specified labels',
  text: 'Melt butter in a heavy skillet over medium heat.
        Add onion; cook and stir until onion starts to brown,
        about 5 minutes. Season with salt and pepper.',
  attachments: [
    {
      type: 'text',
      content: '**Please review this context**:
                I want to buy 1oz hand sanitizer please.'
    }
  ],
  merge_newlines: false,
  allow_overlapping_annotations: false,
  labels: [
    {
      name: 'T_INGR',
      display_name: 'Ingredients',
      children: [{
        name: 'T_Butter',
        display_name: 'Butter'
        }]
    }
  ],
  project: 'projectName',
  batch: 'batchName',
  callback_url: 'http://www.example.com/callback',
  relationships: [
    {
      name: 'R_ADD',
      display_name: 'is added to',
      is_directed: true,
      source_label: 'T_INGR',
      target_label: 'T_INGR'
    }
  ],
  tags: ['tag1']
})
  .then(({ data }) => console.log(data))
  .catch(err => console.error(err));

Response

{
  "task_id": "5c3f9c25744e7d005052e319",
  "created_at": "2019-01-16T21:03:33.166Z",
  "callback_url": "http://www.example.com/callback",
  "instruction": "Label all ingredients and cookware.
                    Please include relevant adjectives,
                    for example **red apple** instead of just **apple**.",
  "type": "namedentityrecognition",
  "status": "pending",
  "params": {
    "text": "Melt butter in a heavy skillet over
            medium heat. Add onion; cook and stir until
            onion starts to brown, about 5 minutes.
            Season with salt and pepper.",
    "labels": [
      {
        "name": "T_INGR",
        "display_name": "Ingredients",
        "children": [
          {
            "name": "T_Butter",
            "display_name": "Butter"
          }
        ]
      }
    ]
  },
  "is_test": false,
  "attachments": [
    {
      "type": "text",
      "content": "**Please review this context**: 
                I want to buy 1oz hand sanitizer please."
    }
  ],
  "metadata": {}
}

Updated about 2 months ago