Introduction
ML Analyzer is a swiss army knife of NLP and classifications API’s hosted on the mashape platform. Some of the tools include Article Summarization, Sentiment Analysis, Stock symbol extraction, Person Names Extractor, Language Detection, Locations Extractor and Adult content Analyzer. ML Analyzer has been featured in several academic studies including the Zurich University of Applied Sciences
Authentication
To authorize, sign up for a mashape account. Then use the authorization key in your requests to the api. Ex : X-Mashape-Key: meowmeowmeow
curl --get --include 'https://nehac-ml-analyzer.p.mashape.com/adult?text=encoded+text' \
-H 'X-Mashape-Key: meowmeowmeow' \
-H 'Accept: application/json'
Make sure to replace
meowmeowmeow
with your API key.
ML Analyzer uses API keys to allow access to the API. You can register a new API key at Mashape’s developer portal.
ML Analyzer expects for the API key to be included in all API requests to the server in a header that looks like the following:
X-Mashape-Key: meowmeowmeow
ML Analyzer Toolkit
Adult Content Analyzer
curl --get --include 'https://nehac-ml-analyzer.p.mashape.com/adult?text=encoded+text' \
-H 'X-Mashape-Key: NdJHeGk8vMmshhO5wcqdPcASbtFfp1S5w5HjsnrhsCg8aNisSn' \
-H 'Accept: application/json'
The above command returns JSON structured like this:
{
"value": "Non-Adult"
}
Analyze a block of text for adult content (English only)
HTTP Request
GET https://nehac-ml-analyzer.p.mashape.com/adult
Query Parameters
Parameter | Type | Description |
---|---|---|
callback | String | A callback to use for PJSON calls |
text | Encoded String | The block of text to analyze |
Article Summarizer
curl -X POST --include 'https://nehac-ml-analyzer.p.mashape.com/article/p' \
-H 'X-Mashape-Key: NdJHeGk8vMmshhO5wcqdPcASbtFfp1S5w5HjsnrhsCg8aNisSn' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: text/plain' \
-d 'size=3' \
-d 'text=Hello world this is cool'
The above command returns JSON structured like this:
[
"The gameplay is very similar to that of its predecessors, with a focus on combo-based combat.",
"The game features quick time events that require the player to complete game controller actions in a timed sequence to defeat stronger enemies and bosses.",
"Considered one of the best games on the platform, it has won several awards and had sold 3.2 million copies worldwide by June 2012."
]
This algorithm uses a combination of word entity detection, semantic analysis of entities and sentence detection to summarize a given block of text into it core subject lines.
HTTP Request
POST https://nehac-ml-analyzer.p.mashape.com/article/p
Query Parameters
Parameter | Type | Description |
---|---|---|
size | Number | The number of sentences to summarize the text into. |
text | Encoded String | The body of text to summarize |
Sentiment Analyzer
curl --get --include 'https://nehac-ml-analyzer.p.mashape.com/sentiment?text=hey+this+is+good' \
-H 'X-Mashape-Key: NdJHeGk8vMmshhO5wcqdPcASbtFfp1S5w5HjsnrhsCg8aNisSn' \
-H 'Accept: application/json'
The above command returns JSON structured like this:
{
"value": "Positive"
}
Analyze a text block for sentiment (English only)
There are 3 levels of analysis
Document cleansing using a curated set of stop words, stemming etc Sentiment classification using trained ML models. ( Algorithm : variant of SVM ) 2.1. We use short documents ( tweets, comments etc ) for training on sentiment of phrases and short sentences 2.3 . We use larger documents ( web pages, articles etc ) for training on sentiment of multi paragraph contexts. Use heuristics to convert contexts to features. An example is is ‘not so good’ is translated into a negative feature v/s capturing good as a positive feature.
HTTP Request
GET https://nehac-ml-analyzer.p.mashape.com/sentiment
Query Parameters
Parameter | Type | Description |
---|---|---|
callback | String | A callback to use for PJSON calls |
text | Encoded String | The block of text to analyze sentiment |
Errors
The ML Analyzer API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request – Your request sucks |
401 | Unauthorized – Your API key is wrong |
403 | Forbidden – The kitten requested is hidden for administrators only |
404 | Not Found – The specified kitten could not be found |
405 | Method Not Allowed – You tried to access a kitten with an invalid method |
406 | Not Acceptable – You requested a format that isn’t json |
410 | Gone – The kitten requested has been removed from our servers |
418 | I’m a teapot |
429 | Too Many Requests – You’re requesting too many kittens! Slow down! |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarily offline for maintenance. Please try again later. |