🏷️ Named Entity Recognition API Documentation
📌 Overview
The Named Entity Recognition (NER) API in TyphAI NLP Suite extracts and categorizes named entities from textual data. It identifies entities such as people, organizations, locations, dates, and more, providing the entity type, a confidence score, and structured results.
🛠️ Endpoint
POST https://typhai-nlp-suite.p.rapidapi.com/api/v1/named-entity-recognitions
📥 Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
text | string | ✅ | The input text from which to extract named entities. |
entities | array | ✅ | List of entity types to extract (e.g., PERSON , ORGANIZATION , DATE , LOCATION ). |
📤 Response Example
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"entities": [
{ "entity": "Elon Musk", "type": "PERSON", "confidence": 0.98 },
{ "entity": "SpaceX", "type": "ORGANIZATION", "confidence": 0.97 },
{ "entity": "2002", "type": "DATE", "confidence": 0.95 }
]
}
🛠️ Usage Examples
1️⃣ cURL Request
curl -X POST "https://typhai-nlp-suite.p.rapidapi.com/api/v1/named-entity-recognitions" \
-H "Content-Type: application/json" \
-H "X-RapidAPI-Host: typhai-nlp-suite.p.rapidapi.com" \
-H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
-d '{"text": "Elon Musk founded SpaceX in 2002.", "entities": ["PERSON", "ORGANIZATION", "DATE", "LOCATION"]}'
2️⃣ Fetch API (JavaScript)
fetch(
"https://typhai-nlp-suite.p.rapidapi.com/api/v1/named-entity-recognitions",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Host": "typhai-nlp-suite.p.rapidapi.com",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
},
body: JSON.stringify({
text: "Elon Musk founded SpaceX in 2002.",
entities: ["PERSON", "ORGANIZATION", "DATE", "LOCATION"],
}),
}
)
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error(error));
3️⃣ Axios Request (JavaScript)
import axios from "axios";
const options = {
method: "POST",
url: "https://typhai-nlp-suite.p.rapidapi.com/api/v1/named-entity-recognitions",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Host": "typhai-nlp-suite.p.rapidapi.com",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
},
data: {
text: "Elon Musk founded SpaceX in 2002.",
entities: ["PERSON", "ORGANIZATION", "DATE", "LOCATION"],
},
};
axios
.request(options)
.then((response) => console.log(response.data))
.catch((error) => console.error(error));
🎮 Try It Yourself
const TestNERAPI = () => {
const [apiKey, setApiKey] = useState("");
const [text, setText] = useState("");
const [entities, setEntities] = useState(
"PERSON,ORGANIZATION,DATE,LOCATION"
);
const [response, setResponse] = useState(null);
const [loading, setLoading] = useState(false);
const handleRequest = async () => {
if (!apiKey) {
alert("Please enter your RapidAPI Key.");
return;
}
setLoading(true);
try {
const res = await axios.post(
"https://typhai-nlp-suite.p.rapidapi.com/api/v1/named-entity-recognitions",
{ text, entities: entities.split(",") },
{
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Host": "typhai-nlp-suite.p.rapidapi.com",
"X-RapidAPI-Key": apiKey,
},
}
);
setResponse(res.data);
} catch (error) {
setResponse(error.message);
}
setLoading(false);
};
return (
<div>
<h3>Test Named Entity Recognition API</h3>
<input
type="text"
placeholder="Enter RapidAPI Key"
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
/>
<input
type="text"
placeholder="Enter text"
value={text}
onChange={(e) => setText(e.target.value)}
/>
<input
type="text"
placeholder="Entities (comma-separated)"
onChange={(e) => setEntities(e.target.value)}
/>
<button onClick={handleRequest}>Send Request</button>
{response && <pre>{JSON.stringify(response, null, 2)}</pre>}
</div>
);
};
<TestNERAPI />;
📩 Need Help? Visit our FAQ .
🚀 Start extracting named entities today with TyphAI NLP Suite!
Last updated on