Microsoft Docs

Sentiment Analysis

Azure Cognitive Services Language offers Sentiment Analysis to determine the emotional tone behind a piece of text. It helps you gauge opinions, feedback, and social media conversations at scale.

Key Features

Try it out

Quickstart (JavaScript)

const endpoint = "https://YOUR_RESOURCE_NAME.cognitiveservices.azure.com/";
const key = "YOUR_KEY";

async function getSentiment(text){
  const response = await fetch(endpoint + "text/analytics/v3.2-preview.1/sentiment",{
    method:"POST",
    headers:{
      "Ocp-Apim-Subscription-Key":key,
      "Content-Type":"application/json"
    },
    body:JSON.stringify({
      documents:[{ id:"1", language:"en", text }]
    })
  });
  const data = await response.json();
  return data.documents[0];
}

Pricing

Pay‑as‑you‑go pricing based on the number of text records processed. View detailed pricing.