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

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Senior Data Scientist

@ ITE Management | New York City, United States