Text Language Detection

A Specrom News API endpoint for detecting the language of the input text.

An endpoint for detecting the language of the input text.


import requests

url = "https://specrom-news-api.p.rapidapi.com/"

payload = {
  "api_type": "language_detection",
  "input_text": "While the big-name dropouts have dented Facebook's stock price and prompted leadership to address some of the concerns , it'll take a lot more to stop the company's digital advertising juggernaut. Facebook generated $69.7 billion from advertising in 2019, more than 98% of its total revenue for the year. And most of those ad dollars don't come from companies likeand Coca Cola so much as the sprawling list of small and medium-sized businesses who use Facebook to attract customers and build their brands. Facebook has 8 million advertisers, it said earlier this year. Of those, the highest-spending 100 brands accounted for $4.2 billion in Facebook advertising last year, according to data from marketing research firm Pathmatics -- or only about 6% of the platform's ad revenue. The last time Facebook shared that data itself was in April 2019 , when COO Sheryl Sandberg said the top 100 advertisers represented "
}


headers = {
  "content-type": "application/json",
  "X-RapidAPI-Key": "API_Key",
  "X-RapidAPI-Host": "specrom-news-api.p.rapidapi.com"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
	
	POST / HTTP/1.1
Content-Type: application/json
X-Rapidapi-Key: API_Key
X-Rapidapi-Host: specrom-news-api.p.rapidapi.com
Host: specrom-news-api.p.rapidapi.com
Content-Length: 192

{
	"api_type": "language_detection",
	"input_text": "While the big-name dropouts have dented Facebook's stock price and prompted leadership to address some of the concerns , it'll take a lot more to stop the company's digital advertising juggernaut. Facebook generated $69.7 billion from advertising in 2019, more than 98% of its total revenue for the year. And most of those ad dollars don't come from companies likeand Coca Cola so much as the sprawling list of small and medium-sized businesses who use Facebook to attract customers and build their brands. Facebook has 8 million advertisers, it said earlier this year. Of those, the highest-spending 100 brands accounted for $4.2 billion in Facebook advertising last year, according to data from marketing research firm Pathmatics -- or only about 6% of the platform's ad revenue. The last time Facebook shared that data itself was in April 2019 , when COO Sheryl Sandberg said the top 100 advertisers represented "
}
	
	
Parameter Description
api_type language_detection
input_text The text whose language is to be detected

Output


{"documents":
[
{"Detected_language":
[{"ISO631-1_language_code":"en","normalized_probability":1}]

,"id":"1"}]
}

This endpoint returns a JSON object containing the following elements:

Parameter Description
documents This is a list containing a single dictionary
ISO631-1_language_code two letter detected language code. Take a look at all the language codes here.
normalized_probability Probability estimate (0-1) indicating the level of certainity with the predicted value