Text Sentiment


Introduction

Text Sentiment allow you to predict the sentiment of text either data is POSITIVE , NEGATIVE , NEUTRAL. You can use this result to predict user reviews and many other task on you server side.

Sentiment Analysis

Currently we only support these languages by default Arabic , English , French , Hindi , Spanish , German , italian , Portuguese

Endpoint

Post
   https://api.oyyi.xyz/v1/ml/text-sentiment

Content-Type: application/json

Parameters

  • text Required

    Pass the string text you want to analyze for sentiment.
    • Type: string

Example

Python
import requestsurl = $BASE_URL/ml/text-sentimentstoken = 'your_bearer_token_here'headers = {'Authorization': f'Bearer {token}'}data = { "text": 'i like the oyyi website and apis.'};response = requests.post(url,params=data, headers=headers)print(response.text)
Javascript
const axios = require('axios');const url = $BASE_URL/ml/text-sentiments;const token = 'your_bearer_token_here';const data = { text: 'i like the oyyi website and apis'};const config = {  headers: {    'Authorization': `Bearer ${token}`,    'Content-Type': 'application/json'  }};axios.post(url, data, config)  .then(response => console.log(response.data))  .catch(error => console.error(error));
Dart
import 'dart:io';import 'package:http/http.dart' as http;void main() async {   final url = Uri.parse('$BASE_URL/ml/text-sentiments');  final data ={ "text": 'i like the oyyi website and apis'}; final response = await http.post(    Uri.parse(url),    headers: {'Content-Type': 'application/json'},    body: jsonEncode(data),  );}
Laravel
use Illuminate\Http\Client\Response;use Illuminate\Support\Facades\Http;$url = '$BASE_URL/ml/text-sentiments';$token = 'your_bearer_token_here';$data = ["text" => 'i like the oyyi website and apis'];$response = Http::withHeaders([    'Authorization' => 'Bearer ' . $token,])->post($url,$data);if ($response->successful()) {    $data = $response->json();} else {m    $message = $response->json()['message']m;}
Curl
curl -X POST \  -H {'Authorization: Bearer your_bearer_token_here','Content-type: application/json'} \  -d { "text": 'i like the oyyi website and apis'} \  $BASE_URL/ml/text-sentiments

Response

Default
{  "data": [    {      "label": "positive",      "score": 0.5482088327407837    }  ],}