How to Identify Names, Organizations, and Places in Text
Highlight on the Names Skill
For a human, identifying entities such as names & locations in text is a simple task. But writing a script that does this automatically is very challenging.
In 5 minutes of reading you’ll learn how to identify named entities in any text, audio, or video:
Before we implement this in our code let's give it a run in the studio.
For example, we’ll analyze this segment from Star Wars:
Here I uploaded it into the Language Studio and analyzed it with the Names Skill:
As we can see, the Skill extracted all the names as well as where they appear in the text.
For some entities, the Skill will provide extra information, such as the full name & entity type, based on the context. In this example your can see how it converts “NYC” to “New York City”, and identifies it as a “Location: City”:
To use this in our code, we can now choose the framework we need and copy the generated API call:
As you can see, with one simple API call we can get the names that appear in a text. This can a powerful tool to have in your developer toolbox.
Let's try out some more complex examples to show how powerful this tool can be.
First , we'll run this on this article by using the html to article skill and then the names skill.
You can go to the studio directly and see for yourself .
As you can see, the options are endless. I bet you already have some cool ideas for applications using this tool alone.
# pip install oneai
oneai.api_key = "<YOUR-API-KEY>"
text = "I live in springfield and work at the nuclear plant"
pipeline = oneai.Pipeline(
steps = [
output = pipeline.run(text)
// npm install oneai
const OneAI = require("oneai");
// ES6: import OneAI from "oneai";
const oneai = new OneAI("<YOUR-API-KEY>");
const text = "I live in springfield and work at the nuclear plant";
const pipeline = new oneai.Pipeline(
.then((output) => console.log(output))
.catch((error) => console.error(error));