Azure Text Analytics is a powerful tool that helps you unlock valuable insights from your text data. It's a cloud-based service that uses machine learning algorithms to analyze and understand the meaning behind your text.
With Azure Text Analytics, you can extract key phrases, entities, and sentiment from your text data, giving you a deeper understanding of your customers, products, and services. It's a game-changer for businesses looking to make data-driven decisions.
Azure Text Analytics is part of the Azure Cognitive Services suite, which means it's tightly integrated with other AI-powered tools and services. This makes it easy to incorporate into your existing workflows and applications.
Text Analysis
Text Analysis is a powerful tool in Azure Text Analytics that allows you to understand the sentiment and meaning behind a piece of text. You can use it to analyze customer comments, reviews, or even social media posts to gain valuable insights.
Azure Text Analytics provides three main capabilities: sentiment analysis, entity recognition, and linked entity recognition. Sentiment analysis can detect the sentiment labels (such as "negative", "neutral", and "positive") and confidence scores at the sentence and document-level.
With sentiment analysis, you can classify text as positive, negative, neutral, or mixed. The DocumentSentiment object provides an overall Sentiment that will be either Positive, Negative, Neutral, or Mixed, along with a Confidences property for Positive, Negative, and Neutral classifications.
Here are the possible sentiment labels and their corresponding confidence scores:
Entity recognition can identify healthcare entities, such as medications, dosages, and frequencies. Linked entity recognition can determine the major objects, places, people, and concepts discussed in a document.
Abstractive summarization is a type of summarization that generates a text description of the overall contents of a document. It's like asking a large language model (LLM) to summarize the text for you, but without having to deploy the LLM or structure your prompt.
You can use Azure Text Analytics to analyze a single piece of text or multiple documents at once. The TextDocumentInput approach is helpful when you want to analyze multiple text documents at the same time.
Entity Detection
Entity detection is a powerful feature in Azure Text Analytics that helps you identify and categorize entities in text.
The Entity Detector returns a list of recognized entities with links to a well-known knowledge base, which is useful for understanding the context of the text.
You can use the Entity Detector in various languages, as listed in the Supported languages in Text Analytics API.
Recognizing PII entities is a separate operation that identifies sensitive information like Social Security Numbers and credit card numbers.
Healthcare analysis is another type of entity detection that identifies healthcare-related entities, such as medication names and dosages.
Named Entity Recognition (NER) is a specific type of entity detection that categorizes entities into pre-defined classes like person, location, event, product, and organization.
The list of enabled languages for NER can be found in the Supported languages in Text Analytics API.
Language Detector
The Language Detector is a powerful tool in Azure Text Analytics that helps identify the language of text input for each document. It returns language identifiers with a score that indicates the strength of the analysis.
This capability is useful for content stores that collect arbitrary text, where language is unknown. The Language Detector can be a game-changer for businesses that need to analyze text data from diverse sources.
The Language Detector is part of the Text Analytics API, which supports a list of enabled languages. You can check the Supported languages in Text Analytics API to see which languages are available.
Here's a list of the supported languages:
- Supported languages in Text Analytics API
Note: The list above is just a placeholder, you can replace it with the actual list of supported languages from the article section facts.
The Language Detector can be used in conjunction with other Azure AI services, such as Sentiment Analysis and Key Phrase Extraction, to gain deeper insights into text data.
Recognize PII Entities
Azure Text Analytics provides a separate endpoint and operation for recognizing Personally Identifiable Information (PII) in text.
This endpoint is similar to the standard entity recognition, but its usage is specifically designed to identify sensitive information such as Social Security Numbers, bank account information, and credit card numbers.
The PII entity recognition can give you a confidence level on its prediction, which can be helpful if you only want to redact certain types of PII in your documents.
Azure also provides the offset of each string within the document text, allowing you to perform string operations to redact the text and hide these entities.
PII entity recognition can identify phone numbers, email addresses, and other sensitive pieces of information, and can help you maintain the privacy and security of your customers' data.
Healthcare Entities
Healthcare entities can be recognized in text, identifying information related to patient treatment. This includes analyzing patient records and treatment notes.
Healthcare entity recognition is specifically designed to detect information related to patient treatment. It can be used to quickly index medical records for later search or analysis.
The service returns specific categories for each entity, such as Dosage, MedicationName, and Frequency. For example, given input text "Prescribed 100mg ibuprofen, taken twice daily", the service returns "100mg" as Dosage, "ibuprofen" as MedicationName, and "twice daily" as Frequency.
Healthcare entity recognition can be used to identify plausible healthcare-related information, such as flagging "death" as a Diagnosis with 82% confidence and "partner" as a FamilyRelation at 88% confidence.
Authentication and API
To access the Text Analytics API, you'll need to create a client object and authenticate it with either Azure Active Directory credentials or an API key credential.
You can find the endpoint for your Text Analytics resource in the Azure Portal or by using the Azure CLI snippet provided. Note that the API key is also known as a "subscription key" or "subscription API key".
Once you have an API key and endpoint, you can use the AzureKeyCredential class to authenticate the client. The AzureKeyCredential class is used to authenticate the client when using an API key.
Here's a summary of the authentication options:
Using an API key is a straightforward process: simply retrieve an API key from the Azure Portal or using the Azure CLI snippet, and then use the AzureKeyCredential class to authenticate the client.
Create a New Cognitive Services Resource
To create a new Azure Cognitive Services resource, you'll need to follow the Azure documentation, which gives you the choice between creating a multi-service or single-service resource.
A multi-service resource enables access to all the Cognitive Services APIs, including Text Analytics.
You'll need to specify the Azure location and the pricing tier on the Resource creation page.
Note down the chosen location, as this information will be needed later.
The location is important because it determines where your data will be stored and processed.
You can choose from a variety of pricing tiers to suit your needs.
Once you've created the resource, you'll be able to access the keys and endpoint blade to obtain the necessary information for connecting to your Azure resources from code.
Client Authentication
You can authenticate a Text Analytics client using either Azure Active Directory credentials or an API key credential. The endpoint of your Text Analytics resource and the credential are required to create a client object.
To find the endpoint for your text analytics resource, you can use the Azure Portal or the Azure CLI snippet. Sometimes the API key is referred to as a "subscription key" or "subscription API key."
Once you have an API key and endpoint, you can use the AzureKeyCredential class to authenticate the client. This is done by using the Azure Portal to browse to your Text Analytics resource and retrieve an API key, or by using the Azure CLI snippet.
There are two types of credentials: Azure Active Directory credentials and API key credentials. Both can be used to authenticate the client.
Here are the steps to authenticate using an API key:
- Use the Azure Portal to retrieve an API key from your Text Analytics resource.
- Use the Azure CLI snippet to retrieve an API key.
- Use the AzureKeyCredential class to authenticate the client.
Note that using an API key is a common way to authenticate a Text Analytics client.
Frequently Asked Questions
What is the difference between text analytics and Luis?
Text Analytics and Language Understanding (LUIS) differ in their focus, with Text Analytics extracting sentiment, key phrases, and language detection from text, while LUIS focuses on understanding user intent from natural language input. Understanding the nuances of each can help you build more effective and user-friendly applications.
What is the difference between text analysis and text analytics?
Text analysis is a basic process of detecting keywords and patterns in text, whereas text analytics uses AI to deeply understand and extract meaningful insights from large volumes of text. This advanced process unlocks new levels of text understanding and analysis.
Which are the two NLP services in Microsoft Azure?
Microsoft Azure offers two NLP services: Language Understanding for intent recognition and conversational understanding, and QnA Maker for knowledge-based question answering. Both services help developers build more effective and user-friendly AI experiences.
What is text analytics used for?
Text analytics helps identify trends and patterns in large amounts of feedback data, while also determining sentiment - whether feedback is positive or negative. This powerful tool provides valuable insights to inform business decisions.
Sources
- https://www.dataiku.com/product/plugins/azure-cognitive-services-nlp/
- https://learn.microsoft.com/en-us/azure/synapse-analytics/machine-learning/tutorial-text-analytics-use-mmlspark
- https://www.npmjs.com/package/@azure/ai-text-analytics
- https://enessoztrk.medium.com/azure-cognitive-services-text-analytics-api-d503451c73a0
- https://accessibleai.dev/post/azureaitextanalytics/
Featured Images: pexels.com