📊 Keyword & Keyphrase Extraction API Documentation
📌 Overview
The Keyword & Keyphrase Extraction API in TyphAI NLP Suite helps you identify important keywords and keyphrases from text using various advanced methods:
- TF-IDF Extraction – Identifies relevant single-word keywords.
- RAKE Extraction – Extracts significant multi-word keyphrases.
- Topic Modeling (LDA, NMF) – Discovers underlying topics within text.
🛠️ Endpoint
POST https://typhai-nlp-suite.p.rapidapi.com/api/v1/keyword-extractions
📥 Request Parameters
📌 Example Request Body
{
"text": "Artificial Intelligence is transforming industries like healthcare and finance.",
"method": "TfIdf",
"coincidences": 5
}
Parameter | Type | Required | Description |
---|---|---|---|
text | string | ✅ | The input text for analysis. |
method | string | ✅ | Extraction method: TfIdf , Rake , Lda , or Nmf . |
coincidences | integer | ❌ | Number of keywords or topics to return (default: 10). |
📤 Response Examples
1️⃣ TF-IDF Extraction
{
"method": "TfIdf",
"keywords": [
{ "keyword": "Artificial Intelligence", "score": 0.85 },
{ "keyword": "healthcare", "score": 0.78 }
]
}
2️⃣ RAKE Extraction
{
"method": "Rake",
"keywords": [
{ "keyword": "Artificial Intelligence", "score": 4.8 },
{ "keyword": "transforming industries", "score": 3.7 }
]
}
3️⃣ Topic Modeling (LDA)
{
"method": "Lda",
"topics": [
{
"topic": "AI & Industry",
"keywords": ["Artificial Intelligence", "healthcare", "finance"]
}
]
}
4️⃣ Topic Modeling (NMF)
{
"method": "Nmf",
"topics": [
{
"topic": "Innovation",
"keywords": ["Artificial Intelligence", "transforming", "finance"]
}
]
}
🚀 Usage Examples
1️⃣ cURL Request
curl -X POST "https://typhai-nlp-suite.p.rapidapi.com/api/keyword-extractions" \
-H "Content-Type: application/json" \
-H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
-d '{"text": "AI transforms industries.", "method": "TfIdf", "coincidences": 5}'
2️⃣ Fetch API (JavaScript)
fetch("https://typhai-nlp-suite.p.rapidapi.com/api/v1/keyword-extractions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
},
body: JSON.stringify({
text: "AI transforms industries.",
method: "TfIdf",
coincidences: 5,
}),
})
.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/keyword-extractions",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
},
data: {
text: "AI transforms industries.",
method: "TfIdf",
coincidences: 5,
},
};
axios
.request(options)
.then((response) => console.log(response.data))
.catch((error) => console.error(error));
🎮 Try It Yourself
const TestKeywordExtractionAPI = () => {
const [apiKey, setApiKey] = useState("");
const [text, setText] = useState("");
const [method, setMethod] = useState("TfIdf");
const [response, setResponse] = useState(null);
const handleRequest = async () => {
if (!apiKey) {
alert("Please enter your RapidAPI Key.");
return;
}
try {
const res = await axios.post(
"https://typhai-nlp-suite.p.rapidapi.com/api/v1/keyword-extractions",
{ text, method },
{
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Key": apiKey,
},
}
);
setResponse(res.data);
} catch (error) {
setResponse(error.message);
}
};
return (
<div>
<h3>Test Keyword Extraction 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)}
/>
<select value={method} onChange={(e) => setMethod(e.target.value)}>
<option value="TfIdf">TF-IDF</option>
<option value="Rake">RAKE</option>
<option value="Lda">LDA</option>
<option value="Nmf">NMF</option>
</select>
<button onClick={handleRequest}>Send Request</button>
{response && <pre>{JSON.stringify(response, null, 2)}</pre>}
</div>
);
};
<TestKeywordExtractionAPI />;
📩 Need Help? Visit our FAQ .
🚀 Start extracting keywords today with TyphAI NLP Suite!
Last updated on