Tutorial
Text Processing
8 min reading

How to Extract Custom Entities in Text Content with JavaScript?

Summarize this article with:

summary
  • Custom Named Entity Recognition (NER) API is a tool that enables users to build and deploy their own models for recognizing and extracting named entities from text such as names of people, organizations,...
  • A Custom NER API enables users to train models with their own labeled data, specifying the exact entities they want to extract.
  • After training, developers can easily integrate the custom NER capabilities into their applications through the API.
  • Developers can Extract Custom Entities in Text Content with JavaScript? using a REST API that accepts standard inputs and returns structured JSON responses.
  • The integration works with Python, JavaScript, PHP, and any HTTP-capable language with minimal setup.

In this tutorial, you’ll learn how to use the Custom Named Entity Recognition API with Javascript in just 5 minutes. Eden AI offers a simple, developer-friendly interface to extract specific entities from text effortlessly.

What is Custom Named Entity Recognition API?

Custom Named Entity Recognition (NER) API is a tool that enables users to build and deploy their own models for recognizing and extracting named entities from text such as names of people, organizations, locations, dates, or any other custom-defined categories.

A Custom NER API enables users to train models with their own labeled data, specifying the exact entities they want to extract.

This approach offers more precise and domain-specific entity recognition tailored to specific industries or use cases.

After training, developers can easily integrate the custom NER capabilities into their applications through the API.

How to Extract Custom Entities in Text Content?

Get Access to Eden AI API

1. Sign up: Create an account on Eden AI and obtain your API key. This key will give you access to a wide range of AI services including Custom Named Entity Recognition.

2. Access Text Processing: Once you're logged in, navigate to the Text section of the Eden AI platform to explore the available tools and features.

3. Choose Custom Named Entity Recognition: Click on the Custom Named Entity Recognition feature.

Implementing the Feature in JavaScript

Install JavaScript Requests Module

For this tutorial, we’ll use axios, a promise-based HTTP client for Node.js. To install it, run:



npm install axios

Prepare the Code

Here’s a working example of how to use the Eden AI Custom Named Entity Recognition API in JavaScript:



const axios = require("axios").default;

const options = {
method: "POST",
url: "https://api.edenai.run/v2/text/custom_named_entity_recognition",
headers: {
authorization: "Bearer YOUR_API_KEY_HERE", // Replace with your actual API key
},
data: {
providers: "openai", // You can also test other providers on Eden AI
text: "I was born in Lyon in February 1996",
entities: ["person", "date"] // Define the custom entities you want to extract
}
};

axios
.request(options)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});

Code Explanation

  • url: The endpoint for Eden AI’s Custom NER API.
  • authorization: The Bearer token (your API key).
  • text: The input string to analyze.
  • entities: A list of custom entities you want the model to detect (e.g., person, date).

Example Output

A sample response might look like this:



{
"openai": {
"entities": [
{ "entity": "Lyon", "category": "location", "start": 16, "end": 20 },
{ "entity": "February 1996", "category": "date", "start": 24, "end": 38 }
],
"status": "success"
}
}

Explanation:

  • entities: An array of extracted items, each with:
    • entity: The detected string.
    • category: The category label you defined (e.g., "date").
    • start and end: Character index positions in the original text.
  • status: Indicates if the operation was successful.

Why Eden AI is the Best Tool for Custom Named Entity Recognition

Multi-provider Access

Test and use top AI models (like OpenAI, Google, Amazon, etc.) from a single API.

Customizability

Easily define the entities that matter to your domain.

Cost-Efficient

Pay-as-you-go pricing and cost-optimization by comparing multiple provider results.

Developer-Friendly

Clean JSON responses and easy integration with most languages, including JavaScript.

Conclusion

With just a few lines of JavaScript and Eden AI’s powerful API, you can implement a Custom NER system that fits your exact needs.

Whether you're working on content moderation, business automation, or intelligent search, this feature saves you time and boosts accuracy.

Eden AI simplifies complex AI integration, letting you focus on building great user experiences.

Try it today and unlock the full potential of your text data with custom entity extraction!

FAQ — Extract Custom Entities in Text

You need an API key from your chosen AI provider. Eden AI lets you access multiple providers with a single key, removing the need for separate vendor accounts.
Any language that supports HTTP requests works — Python, JavaScript, PHP, Ruby, Go, and more. Ready-to-use code snippets are available for the most common languages.
Most developers complete a basic integration in under an hour using standardized API endpoints and ready-to-use code examples.
Implement exponential backoff for rate limit errors and use try-catch blocks for network failures. Eden AI's built-in fallback routing automatically redirects requests if a provider is unavailable.
Eden AI supports GDPR-compliant provider filtering and does not store or reuse your data, ensuring compliance with European privacy regulations.

Similar articles

Tutorial
Generative AI
How to Generate Videos Using Python
9/4/2025
·
Written byTaha Zemmouri
let’s start

Start building with Eden AI

A single interface to integrate the best AI technologies into your products.