April 14, 2024, 8:43 p.m. | Olatunji Ayodele Abidemi

DEV Community dev.to

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)

ai ai solution algorithms analyze azure azure ai client core designing document example function import key microsoft microsoft azure microsoft azure ai negative python sentiment set solution usage

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US

Research Engineer

@ Allora Labs | Remote

Ecosystem Manager

@ Allora Labs | Remote

Founding AI Engineer, Agents

@ Occam AI | New York