from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential
Set up the client with your Azure key and endpoint
key = "your-key-here"
endpoint = "your-endpoint-here"
text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))
Example function to analyze sentiment
def analyze_sentiment(
print("Document Sentiment: response.confidence_scores.neutral,
response.confidence_scores.negative,
))
Example usage
text_to_analyze = "Azure AI is quite impressive!"
analyze_sentiment(text_to_analyze)
Top comments (0)