logo

Hate Speech API

by Pau Escofet

Overview

This is the first version of the API, and doesn't need authentication, it's free to use

BASE URL: https://hatespeech.pauescofet.com

Endpoints

Info

Languages

GET /languages

Info about the languages that are currently available

Body
 # no body required
Response
[
 {
  "code": "en",
  "language": "english",
  "status": "active"
 },
 {
  "code": "es",
  "language": "español",
  "status": "disabled"
 }
]

Predict

Predict English

POST /hatespeech/en

Endpoint to predict a maximum of 10 english quotes at a time

Body
{
 data: [
  "quote to be predicted 1",
  "quote to be predicted 2",
  " ... ",
 ]
}
Response
{
 # array with the predicted probability of each quote
prob: []
 # array with the predicted category in text
text: []
 # array with the predicted category in numbers
values: []
}

Predict Spanish

Currently no available

Examples in Python

import requests
import json


# language endpoint
response = requests.get('https://hatespeech.pauescofet.com/languages')
print(response.status_code)
# out: 200

res_json = json.loads(response.text)
print(res_json)
# out:



# predict endpoint
data = {
 'data': [
  "I think you are cool",
  "I am going to kill you",
  "You are a bitch",
  "I hate you",
  "Maybe we could go for a drink some day"
 ]
}
response = requests.post(url = 'https://hatespeech.pauescofet.com/hatespeech/en', json = data) print(response.status_code)
# out: 200

res_json = json.loads(response.text)
print(res_json)
# out:
For any issues please contact me: Pau Escofet