BASE URL : https://abshabd.apshabd.workers.dev
The Profanity Detection API is designed to detect and flag profane language in text messages. It processes the input message, checks for profanity, and returns the result along with the detected offensive text if any.
bash/gaali
POST
Content-Type: application/json
The request body must be a JSON object with the following structure:
json{ "message": "Your message here" }
message
(string): The text message to be analyzed. Must be no longer than 500 characters.
json{ "message": "tu ##### hai" }
The response will be a JSON object with the following structure:
json{ "isProfanity": true, "score": 0.95, "flaggedFor": "#####" }
isProfanity
(boolean): Indicates if the message contains profanity.score
(number): The similarity score of the detected profane content.flaggedFor
(string): The text that was flagged as profane.
json{ "isProfanity": false, "score": 0.45 }
isProfanity
(boolean): Indicates if the message contains profanity.score
(number): The highest similarity score observed.
Content-Type not JSON:
json{ "error": "JSON Body Expected." }
Status Code:
406
Message Argument Missing:
json{ "error": "Message Argument is Required." }
Status Code:
400
Message Too Long:
json{ "error": "Message can only be at most 500 characters." }
Status Code:
413
Internal Server Error:
json{ "error": "Something Went Wrong" }
Status Code:
500
shcurl -X POST https://abshabd.apshabd.workers.dev/gaali \ -H "Content-Type: application/json" \ -d '{"message": "tu ##### hai"}'
javascriptfetch('https://abshabd.apshabd.workers.dev/gaali', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: "tu ##### hai" }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
pythonimport requests
url = 'https://abshabd.apshabd.workers.dev/gaali' headers = { 'Content-Type': 'application/json', } data = { 'message': 'tu ##### hai' }
response = requests.post(url, headers=headers, json=data) print(response.json())
Make sure to set the following environment variables for the API to function correctly:
VECTOR_URL
: URL of the vector database.VECTOR_TOKEN
: Token for authenticating requests to the vector database.
- Clone the repository.
- Install dependencies using
npm install
. - Deploy to your serverless environment (e.g., Cloudflare Workers).
- Set the required environment variables (
VECTOR_URL
andVECTOR_TOKEN
). - Access the API at the
/gaali
endpoint.