RapidAPI logo

Text Clustering

FREEMIUM
By MeaningCloud
Updated 2 months ago
4.1/10
Popularity Score
880ms
Latency
100%
Success Rate

Text Clustering API Documentation

Text Clustering is MeaningCloud's solution for automatic document clustering, i.e., the task of grouping a set of texts in such a way that texts in the same group (called a cluster) are more similar to each other than to those in other clusters.

View API Details
POST/clustering-1.1
POST/clustering-1.1

Text Clustering 1.1

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
AcceptSTRING
OPTIONAL
Required Parameters
langSTRING
REQUIREDLanguage in which the text is ('en', 'es', 'it', 'fr', 'pt')
txtSTRING
REQUIREDThis parameter will contain one or more texts, one per line. All the texts sent in this parameter will be assigned automatically the ID used to identify them at the output. The IDs will be numerical, and will start from 1.
Optional Parameters
idSTRING
OPTIONALThis parameter will contain the IDs associated to the input texts. Each ID will have to be included in a different line, and the number of IDs included has to be the same as the number of texts included in txt.
modeSTRING
OPTIONALThis parameter will define the approach used to carry out the clustering process. To read more about the possibilities check the Clustering modes section: https://www.meaningcloud.com/developer/text-clustering/doc/1.1/request#clustering-modes
swSTRING
OPTIONALStopwords to be ignored by the algorithm, both in the clustering process, and as labels for the clusters. The valid format is a stopword per line (separated by linefeed "\n"). These stopwords are added to the ones used by default for the selected lang.
Code Snippet
unirest.post("https://meaningcloud-text-clustering-v1.p.rapidapi.com/clustering-1.1")
.header("X-RapidAPI-Host", "meaningcloud-text-clustering-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Accept", "application/json")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("id=text01%0Atext02%0Atext03%0Atext04%0Atext05")
.send("lang=en")
.send("txt=He earns $200,000/yr and still has a mortgage on his house :(%0AZara clothes will be the death of my credit card%0AMy bank insisted I destroyed my credit card before I could get a mortgage%0AI'm not paying the mortgage or credit card bills%0ATell them you've never had a loan, you have no mortgage")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://meaningcloud-text-clustering-v1.p.rapidapi.com/clustering-1.1
Request Method: POST
Response Headers
Response Body
Log inSign up

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://meaningcloud-text-clustering-v1.p.rapidapi.com/clustering-1.1")
.header("X-RapidAPI-Host", "meaningcloud-text-clustering-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Accept", "application/json")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("id=text01%0Atext02%0Atext03%0Atext04%0Atext05")
.send("lang=en")
.send("txt=He earns $200,000/yr and still has a mortgage on his house :(%0AZara clothes will be the death of my credit card%0AMy bank insisted I destroyed my credit card before I could get a mortgage%0AI'm not paying the mortgage or credit card bills%0ATell them you've never had a loan, you have no mortgage")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication