Text Classification

Input the headline or meta description of a news article and to generate a topic tag using a text classifier.

All our plans include a base level text classifier taxonomy; if you need a more granular text classifier that contains over 1900 topics, please email us at info@specrom.com

Fetch local news using geolocation coordinates (latitude, longitude) as input

The topics for the base level text classifier taxonomy are:

“arts and entertainment”, “automotive”, “business”, “careers”, “education”, “family and parenting”, “food and drink”, “health and fitness”, “hobbies and interests”, “home and garden”, “illegal content”, “law and government and politics”, “non standard content”, “personal finance”, “pets”, “real estate”, “religion and spirituality”, “science”, “shopping”, “society”, “sports”, “style and fashion”, “technology and computing”, “travel”

Input

import requests

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

payload = {
  "api_type": "topic_detection_base_classifier",
  "input_text": "Top 20 Berkshire Hathaway holdings: What's in Warren Buffett portfolio going into 2023?"
}
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: 96

{
    "api_type": "topic_detection_base_classifier",
    "input_text": "Top 20 Berkshire Hathaway holdings: What's in Warren Buffett portfolio going into 2023?"
}
	
	
Parameter Description
api_type topic_detection_base_classifier
input_text input text

Output


{"Topic":"business"}
Parameter Description
Topic Predicted topic tag of the input text