Names

Finds spans in the text with names, and identifies the name type (person, organization, location etc.).

PERSON Michael Jordan played most of his career in LOCATION
{value:"New York CITY",
"type":"CITY"}
NYC.
 

📘

Use Names Skill to extract names from:

👍

Benchmarks

Coming soon...

Output labels

Identities:

  • ORG - Companies, agencies, institutions, etc.
  • PERSON - People, real or fictional characters
  • PRODUCT - Products and services

Places:

  • GEO - Countries and States
  • LOCATION - Cities, buildings, airports, highways, bridges
  • EVENT - Sports events, Named hurricanes, wars, etc.

Others:

  • ART - Titles of books, movies, songs, etc.
  • LANGUAGE - Language names.
  • LAW - Named documents made into laws.

Parameters

Name

Type

Description

Default

enhancement

boolean

Whether to enhance each label with metadata

true

Example

Request

curl -X POST \
'https://api.oneai.com/api/v0/pipeline' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'api-key: <YOUR-API-KEY-HERE>' \
-d '{
    "input": "My name is Shawn, I live in Chicago in the state of Illinois but I don't speak Portuguese.",
    "steps": [
      {
        "skill": "names"
      }   
    ]
}'
const { OneAI } = require("oneai");
const oneai = new OneAI("<YOUR-API-KEY-HERE>");
const text = "My name is Shawn, I live in Chicago in the state of Illinois but I don't speak Portuguese.";
const pipeline = new oneai.Pipeline(
    oneai.skills.names(),
);

pipeline.run(text).then(console.log);
import oneai

oneai.api_key = "<YOUR-API-KEY-HERE>"
text = "My name is Shawn, I live in Chicago in the state of Illinois but I don't speak Portuguese."
pipeline = oneai.Pipeline(
  steps = [
        oneai.skills.Names(),
  ]
)

output = pipeline.run(text)

Response

{
  "input_text": "My name is Shawn, I live in Chicago in the state of Illinois but I don't speak Portuguese.",
  "status": "success",
  "output": [
    {
      "text_generated_by_step_name": "input",
      "text_generated_by_step_id": 0,
      "text": "My name is Shawn, I live in Chicago in the state of Illinois but I don't speak Portuguese.",
      "labels": [
        {
          "type": "name",
          "skill": "names",
          "name": "PERSON",
          "value": "Shawn",
          "data": {},
          "span_text": "Shawn",
          "span": [
            11,
            16
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 11,
              "end": 16
            }
          ]
        },
        {
          "type": "name",
          "skill": "names",
          "name": "LOCATION",
          "value": "Chicago",
          "data": {
            "type": "CITY"
          },
          "span_text": "Chicago",
          "span": [
            28,
            35
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 28,
              "end": 35
            }
          ]
        },
        {
          "type": "name",
          "skill": "names",
          "name": "GEO",
          "value": "Illinois",
          "data": {
            "type": "STATE",
            "country": "UNITED STATES"
          },
          "span_text": "Illinois",
          "span": [
            52,
            60
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 52,
              "end": 60
            }
          ]
        },
        {
          "type": "name",
          "skill": "names",
          "name": "LANGUAGE",
          "value": "Portuguese language",
          "data": {},
          "span_text": "Portuguese",
          "span": [
            79,
            89
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 79,
              "end": 89
            }
          ]
        }
      ]
    }
  ],
  "stats": {
    "concurrency_wait_time": 0,
    "total_running_jobs": 1,
    "total_waiting_jobs": 0
  }
}
{
  text: "My name is Shawn, I live in Chicago in the state of Illinois but I don't speak Portuguese.",
  names: [
    {
      type: 'name',
      skill: 'names',
      name: 'PERSON',
      value: 'Shawn',
      data: {},
      span_text: 'Shawn',
      span: [ 11, 16 ],
      output_spans: [ { section: 0, start: 11, end: 16 } ]
    },
    {
      type: 'name',
      skill: 'names',
      name: 'LOCATION',
      value: 'Chicago',
      data: { type: 'CITY' },
      span_text: 'Chicago',
      span: [ 28, 35 ],
      output_spans: [ { section: 0, start: 28, end: 35 } ]
    },
    {
      type: 'name',
      skill: 'names',
      name: 'GEO',
      value: 'Illinois',
      data: { type: 'STATE', country: 'UNITED STATES' },
      span_text: 'Illinois',
      span: [ 52, 60 ],
      output_spans: [ { section: 0, start: 52, end: 60 } ]
    },
    {
      type: 'name',
      skill: 'names',
      name: 'LANGUAGE',
      value: 'Portuguese language',
      data: {},
      span_text: 'Portuguese',
      span: [ 79, 89 ],
      output_spans: [ { section: 0, start: 79, end: 89 } ]
    }
  ]
}

Did this page help you?