azure.textanalytics
Module azure.textanalytics
API
Definitions
ballerinax/azure.textanalytics Ballerina library
Overview
Azure Text Analytics is a suite of natural language processing (NLP) services built with Microsoft machine learning algorithms. It analyzes unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and entity recognition, with additional support for healthcare and personal information analysis.
The Azure Text Analytics connector lets Ballerina applications call the Text Analytics REST API, version 3.1.
Key features
- Detect the language of text documents
- Analyze sentiment, including opinion mining at sentence and target level
- Extract key phrases from unstructured text
- Recognize named entities, personal information and linked entities from a knowledge base
- Run long-running analysis and healthcare jobs and track their status
Setup guide
To use the connector you need an Azure Cognitive Services Language (Text Analytics) resource.
-
Sign in to the Azure portal and create a Language resource.
-
Open the resource and select Keys and Endpoint.
-
Copy one of the subscription keys and the endpoint. The connector sends the key in the
Ocp-Apim-Subscription-Keyheader.
Quickstart
To use the Azure Text Analytics connector in your Ballerina application, update the .bal file as follows.
Step 1: Import the connector.
import ballerinax/azure.textanalytics;
Step 2: Create a Config.toml file with your subscription key and endpoint.
subscriptionKey = "<subscription key>" serviceUrl = "<endpoint>/text/analytics/v3.1"
Step 3: Create a client.
configurable string subscriptionKey = ?; configurable string serviceUrl = ?; textanalytics:Client textAnalytics = check new ({ocpApimSubscriptionKey: subscriptionKey}, serviceUrl = serviceUrl);
Step 4: Detect the language of a document.
public function main() returns error? { textanalytics:LanguageResult _ = check textAnalytics->detectLanguage({ documents: [{id: "1", text: "Hello world"}] }); }
Examples
The Azure Text Analytics connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- Customer feedback insights - Detect the language, score the sentiment and extract key phrases from customer feedback.
- PII redaction review - Redact personal information from support messages and link the remaining entities.
Clients
azure.textanalytics: Client
The Text Analytics API is a suite of natural language processing (NLP) services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Functionality for analysis of text specific to the healthcare domain and personal information are also available in the API. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview
Constructor
Gets invoked to initialize the connector.
init (ApiKeysConfig apiKeyConfig, ConnectionConfig config, string serviceUrl)- apiKeyConfig ApiKeysConfig - API keys for authorization
- config ConnectionConfig {} - The configurations to be used when initializing the
connector
- serviceUrl string "https://westus.api.cognitive.microsoft.com/text/analytics/v3.1" - URL of the target service
submitAnalysisJob
function submitAnalysisJob(AnalyzeBatchInput payload, map<string|string[]> headers) returns Response|errorSubmit analysis job
Parameters
- payload AnalyzeBatchInput - Collection of documents to analyze and tasks to execute
Return Type
getAnalysisJob
function getAnalysisJob(string jobId, map<string|string[]> headers, *GetAnalysisJobQueries queries) returns AnalyzeJobState|errorGet analysis status and results
Parameters
- jobId string - Job ID for Analyze
- queries *GetAnalysisJobQueries - Queries to be sent with the request
Return Type
- AnalyzeJobState|error - Analysis job status and metadata
getHealthcareJob
function getHealthcareJob(string jobId, map<string|string[]> headers, *GetHealthcareJobQueries queries) returns HealthcareJobState|errorGet healthcare analysis job status and results
Parameters
- jobId string - Job ID
- queries *GetHealthcareJobQueries - Queries to be sent with the request
Return Type
- HealthcareJobState|error - OK
cancelHealthcareJob
Cancel healthcare prediction job
Parameters
- jobId string - Job ID
Return Type
- error? - Cancel Job request has been received
submitHealthcareJob
function submitHealthcareJob(MultiLanguageBatchInput payload, map<string|string[]> headers, *SubmitHealthcareJobQueries queries) returns Response|errorSubmit healthcare analysis job
Parameters
- payload MultiLanguageBatchInput - Collection of documents to analyze
- queries *SubmitHealthcareJobQueries - Queries to be sent with the request
Return Type
recognizeEntities
function recognizeEntities(MultiLanguageBatchInput payload, map<string|string[]> headers, *RecognizeEntitiesQueries queries) returns EntitiesResult|errorNamed Entity Recognition
Parameters
- payload MultiLanguageBatchInput - Collection of documents to analyze
- queries *RecognizeEntitiesQueries - Queries to be sent with the request
Return Type
- EntitiesResult|error - A successful call results in a list of recognized entities returned for each valid document
recognizePiiEntities
function recognizePiiEntities(MultiLanguageBatchInput payload, map<string|string[]> headers, *RecognizePiiEntitiesQueries queries) returns PiiResult|errorEntities containing personal information
Parameters
- payload MultiLanguageBatchInput - Collection of documents to analyze
- queries *RecognizePiiEntitiesQueries - Queries to be sent with the request
Return Type
linkEntities
function linkEntities(MultiLanguageBatchInput payload, map<string|string[]> headers, *LinkEntitiesQueries queries) returns EntityLinkingResult|errorLinked entities from a well known knowledge base
Parameters
- payload MultiLanguageBatchInput - Collection of documents to analyze
- queries *LinkEntitiesQueries - Queries to be sent with the request
Return Type
- EntityLinkingResult|error - A successful call results in a list of recognized entities with links to a well known knowledge base returned for each valid document
extractKeyPhrases
function extractKeyPhrases(MultiLanguageBatchInput payload, map<string|string[]> headers, *ExtractKeyPhrasesQueries queries) returns KeyPhraseResult|errorKey Phrases
Parameters
- payload MultiLanguageBatchInput - Collection of documents to analyze
- queries *ExtractKeyPhrasesQueries - Queries to be sent with the request
Return Type
- KeyPhraseResult|error - A successful response results in 0 or more key phrases identified in each valid document
detectLanguage
function detectLanguage(LanguageBatchInput payload, map<string|string[]> headers, *DetectLanguageQueries queries) returns LanguageResult|errorDetect Language
Parameters
- payload LanguageBatchInput - Collection of documents to analyze for language endpoint
- queries *DetectLanguageQueries - Queries to be sent with the request
Return Type
- LanguageResult|error - A successful call results in the detected language with the highest probability for each valid document
analyzeSentiment
function analyzeSentiment(MultiLanguageBatchInput payload, map<string|string[]> headers, *AnalyzeSentimentQueries queries) returns SentimentResponse|errorSentiment
Parameters
- payload MultiLanguageBatchInput - Collection of documents to analyze
- queries *AnalyzeSentimentQueries - Queries to be sent with the request
Return Type
- SentimentResponse|error - A successful call results in a document sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral)
Records
azure.textanalytics: AnalysisInput
Fields
- analysisInput MultiLanguageBatchInput - Contains a set of input documents to be analyzed by the service
azure.textanalytics: AnalyzeBatchInput
Fields
- Fields Included from *JobDescriptor
- displayName string
- anydata...
- Fields Included from *AnalysisInput
- analysisInput MultiLanguageBatchInput
- anydata...
- Fields Included from *JobManifest
- tasks JobManifestTasks
- anydata...
azure.textanalytics: AnalyzeJobDisplayName
Fields
- displayName? string -
azure.textanalytics: AnalyzeJobErrorsAndStatistics
Fields
- errors? TextAnalyticsError[] -
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: AnalyzeJobMetadata
Fields
- Fields Included from *JobMetadata
- Fields Included from *AnalyzeJobDisplayName
- displayName string
- anydata...
azure.textanalytics: AnalyzeJobState
Fields
- Fields Included from *AnalyzeJobMetadata
- Fields Included from *TasksState
- tasks TasksStateTasks
- anydata...
- Fields Included from *AnalyzeJobErrorsAndStatistics
- errors TextAnalyticsError[]
- statistics RequestStatistics
- anydata...
- Fields Included from *Pagination
- atNextLink string
- anydata...
azure.textanalytics: AnalyzeSentimentQueries
Represents the Queries record for the operation: analyzeSentiment
Fields
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
- opinionMining? boolean - (Optional) if set to true, response will contain not only sentiment prediction but also opinion mining (aspect-based sentiment analysis) results
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
- stringIndexType "TextElement_v8"|"UnicodeCodePoint"|"Utf16CodeUnit" (default "TextElement_v8") - (Optional) Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets
azure.textanalytics: ApiKeysConfig
Provides API key configurations needed when communicating with a remote HTTP endpoint.
Fields
- ocpApimSubscriptionKey string - Azure Cognitive Services subscription key supplied in the Ocp-Apim-Subscription-Key header
azure.textanalytics: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 30) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded/x-forwardedheader
- followRedirects? FollowRedirects - Configurations associated with Redirection
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- cookieConfig? CookieConfig - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- socketConfig ClientSocketConfig(default {}) - Provides settings related to client socket configuration
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
- laxDataBinding boolean(default true) - Enables relaxed data binding on the client side. When enabled,
nilvalues are treated as optional, and absent fields are handled asnilabletypes. Enabled by default.
azure.textanalytics: DetectedLanguage
Fields
- confidenceScore decimal - A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true
- iso6391Name string - A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr)
- name string - Long name of a detected language (e.g. English, French)
azure.textanalytics: DetectLanguageQueries
Represents the Queries record for the operation: detectLanguage
Fields
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
azure.textanalytics: DocumentEntities
Fields
- entities Entity[] - Recognized entities in the document
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- id string - Unique, non-empty document identifier
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
azure.textanalytics: DocumentError
Fields
- id string - Document Id
- 'error TextAnalyticsError -
azure.textanalytics: DocumentHealthcareEntities
Fields
- entities HealthcareEntity[] - Healthcare entities
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- id string - Unique, non-empty document identifier
- relations HealthcareRelation[] - Healthcare entity relations
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
azure.textanalytics: DocumentKeyPhrases
Fields
- keyPhrases string[] - A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- id string - Unique, non-empty document identifier
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
azure.textanalytics: DocumentLanguage
Fields
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- detectedLanguage DetectedLanguage -
- id string - Unique, non-empty document identifier
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
azure.textanalytics: DocumentLinkedEntities
Fields
- entities LinkedEntity[] - Recognized well known entities in the document
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- id string - Unique, non-empty document identifier
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
azure.textanalytics: DocumentSentiment
Fields
- sentiment "positive"|"neutral"|"negative"|"mixed" - Predicted sentiment for document (Negative, Neutral, Positive, or Mixed)
- sentences SentenceSentiment[] - Sentence level sentiment analysis
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- id string - Unique, non-empty document identifier
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
- confidenceScores SentimentConfidenceScorePerLabel - Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative
azure.textanalytics: DocumentStatistics
if showStats=true was specified in the request this field will contain information about the document payload
Fields
- charactersCount Signed32 - Number of text elements recognized in the document
- transactionsCount Signed32 - Number of transactions for the document
azure.textanalytics: EntitiesResult
Fields
- documents DocumentEntities[] - Response by document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: EntitiesTask
Fields
- taskName? string -
- parameters? EntitiesTaskParameters -
azure.textanalytics: EntitiesTaskParameters
Fields
- loggingOptOut boolean(default false) -
- modelVersion string(default "latest") -
- stringIndexType? StringIndexType -
azure.textanalytics: EntitiesTaskResult
Fields
- results? EntitiesResult -
azure.textanalytics: Entity
Fields
- confidenceScore decimal - Confidence score between 0 and 1 of the extracted entity
- offset Signed32 - Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned
- length Signed32 - Length for the entity text. Use of different 'stringIndexType' values can affect the length returned
- text string - Entity text as appears in the request
- category string - Entity type
- subcategory? string - (Optional) Entity sub type
azure.textanalytics: EntityLinkingResult
Fields
- documents DocumentLinkedEntities[] - Response by document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: EntityLinkingTask
Fields
- taskName? string -
- parameters? EntitiesTaskParameters -
azure.textanalytics: EntityLinkingTaskResult
Fields
- results? EntityLinkingResult -
azure.textanalytics: ExtractKeyPhrasesQueries
Represents the Queries record for the operation: extractKeyPhrases
Fields
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
azure.textanalytics: GetAnalysisJobQueries
Represents the Queries record for the operation: getAnalysisJob
Fields
- skip int(default 0) - (Optional) Set the number of elements to offset in the response. When both $top and $skip are specified, $skip is applied first
- top int(default 20) - (Optional) Set the maximum number of results per task. When both $top and $skip are specified, $skip is applied first
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
azure.textanalytics: GetHealthcareJobQueries
Represents the Queries record for the operation: getHealthcareJob
Fields
- skip int(default 0) - (Optional) Set the number of elements to offset in the response. When both $top and $skip are specified, $skip is applied first
- top int(default 20) - (Optional) Set the maximum number of results per task. When both $top and $skip are specified, $skip is applied first
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
azure.textanalytics: HealthcareAssertion
Fields
- conditionality? "hypothetical"|"conditional" - Describes any conditionality on the entity
- certainty? "positive"|"positivePossible"|"neutralPossible"|"negativePossible"|"negative" - Describes the entities certainty and polarity
- association? "subject"|"other" - Describes if the entity is the subject of the text or if it describes someone else
azure.textanalytics: HealthcareEntity
Fields
- Fields Included from *HealthcareEntityProperties
- Fields Included from *HealthcareLinkingProperties
- name string
- assertion HealthcareAssertion
- links HealthcareEntityLink[]
- anydata...
azure.textanalytics: HealthcareEntityLink
Fields
- id string - Entity id in the given source catalog
- dataSource string - Entity Catalog. Examples include: UMLS, CHV, MSH, etc
azure.textanalytics: HealthcareEntityProperties
Fields
- confidenceScore decimal - Confidence score between 0 and 1 of the extracted entity
- offset Signed32 - Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned
- length Signed32 - Length for the entity text. Use of different 'stringIndexType' values can affect the length returned
- text string - Entity text as appears in the request
- category string - Healthcare Entity Category. Known values: BodyStructure, Age, Gender, ExaminationName, Date, Direction, Frequency, MeasurementValue, MeasurementUnit, RelationalOperator, Time, GeneOrProtein, Variant, AdministrativeEvent, CareEnvironment, HealthcareProfession, Diagnosis, SymptomOrSign, ConditionQualifier, MedicationClass, MedicationName, Dosage, MedicationForm, MedicationRoute, FamilyRelation, TreatmentName
- subcategory? string - (Optional) Entity sub type
azure.textanalytics: HealthcareJobState
Fields
- Fields Included from *JobMetadata
- Fields Included from *HealthcareTaskResult
- results HealthcareResult
- errors TextAnalyticsError[]
- anydata...
- Fields Included from *Pagination
- atNextLink string
- anydata...
azure.textanalytics: HealthcareLinkingProperties
Fields
- name? string - Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'
- assertion? HealthcareAssertion -
- links? HealthcareEntityLink[] - Entity references in known data sources
azure.textanalytics: HealthcareRelation
Every relation is an entity graph of a certain relationType, where all entities are connected and have specific roles within the relation context
Fields
- relationType string - Type of relation. Known values: Abbreviation, DirectionOfBodyStructure, DirectionOfCondition, DirectionOfExamination, DirectionOfTreatment, DosageOfMedication, FormOfMedication, FrequencyOfMedication, FrequencyOfTreatment, QualifierOfCondition, RelationOfExamination, RouteOfMedication, TimeOfCondition, TimeOfEvent, TimeOfExamination, TimeOfMedication, TimeOfTreatment, UnitOfCondition, UnitOfExamination, ValueOfCondition, ValueOfExamination
- entities HealthcareRelationEntity[] - The entities in the relation
azure.textanalytics: HealthcareRelationEntity
Fields
- ref string - Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity
- role string - Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis)
azure.textanalytics: HealthcareResult
Fields
- documents DocumentHealthcareEntities[] - Response by document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: HealthcareTaskResult
Fields
- results? HealthcareResult -
- errors? TextAnalyticsError[] -
azure.textanalytics: InnerError
Fields
- code string - Error code. Known values: InvalidParameterValue, InvalidRequestBodyFormat, EmptyRequest, MissingInputRecords, InvalidDocument, ModelVersionIncorrect, InvalidDocumentBatch, UnsupportedLanguageCode, InvalidCountryHint
- innererror? InnerError -
- details? record { string... } - Error details
- message string - Error message
- target? string - Error target
azure.textanalytics: JobDescriptor
Fields
- displayName? string - Optional display name for the analysis job
azure.textanalytics: JobManifest
Fields
- tasks JobManifestTasks - The set of tasks to execute on the input documents. Cannot specify the same task more than once
azure.textanalytics: JobManifestTasks
The set of tasks to execute on the input documents. Cannot specify the same task more than once
Fields
- entityRecognitionTasks? EntitiesTask[] -
- entityRecognitionPiiTasks? PiiTask[] -
- entityLinkingTasks? EntityLinkingTask[] -
- keyPhraseExtractionTasks? KeyPhrasesTask[] -
- sentimentAnalysisTasks? SentimentAnalysisTask[] -
azure.textanalytics: JobMetadata
Fields
- jobId string -
- lastUpdateDateTime string -
- expirationDateTime? string -
- createdDateTime string -
- status "notStarted"|"running"|"succeeded"|"failed"|"cancelled"|"cancelling" -
azure.textanalytics: KeyPhraseResult
Fields
- documents DocumentKeyPhrases[] - Response by document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: KeyPhrasesTask
Fields
- taskName? string -
- parameters? KeyPhrasesTaskParameters -
azure.textanalytics: KeyPhrasesTaskParameters
Fields
- loggingOptOut boolean(default false) -
- modelVersion string(default "latest") -
azure.textanalytics: KeyPhraseTaskResult
Fields
- results? KeyPhraseResult -
azure.textanalytics: LanguageBatchInput
Fields
- documents LanguageInput[] -
azure.textanalytics: LanguageInput
Fields
- countryHint? string -
- id string - Unique, non-empty document identifier
- text string -
azure.textanalytics: LanguageResult
Fields
- documents DocumentLanguage[] - Response by document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: LinkedEntity
Fields
- name string - Entity Linking formal name
- language string - Language used in the data source
- id? string - Unique identifier of the recognized entity from the data source
- matches Match[] - List of instances this entity appears in the text
- dataSource string - Data source used to extract entity linking, such as Wiki/Bing etc
- bingId? string - Bing Entity Search API unique identifier of the recognized entity
- url string - URL for the entity's page from the data source
azure.textanalytics: LinkEntitiesQueries
Represents the Queries record for the operation: linkEntities
Fields
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
- stringIndexType "TextElement_v8"|"UnicodeCodePoint"|"Utf16CodeUnit" (default "TextElement_v8") - (Optional) Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets
azure.textanalytics: Match
Fields
- confidenceScore decimal - If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned
- offset Signed32 - Start position for the entity match text
- length Signed32 - Length for the entity match text
- text string - Entity text as appears in the request
azure.textanalytics: MultiLanguageBatchInput
Contains a set of input documents to be analyzed by the service
Fields
- documents MultiLanguageInput[] - The set of documents to process as part of this batch
azure.textanalytics: MultiLanguageInput
Contains an input document to be analyzed by the service
Fields
- language? string - (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default
- id string - A unique, non-empty document identifier
- text string - The input text to process
azure.textanalytics: Pagination
Fields
- atNextLink? string -
azure.textanalytics: PiiDocumentEntities
Fields
- redactedText string - Returns redacted text
- entities Entity[] - Recognized entities in the document
- warnings TextAnalyticsWarning[] - Warnings encountered while processing document
- id string - Unique, non-empty document identifier
- statistics? DocumentStatistics - if showStats=true was specified in the request this field will contain information about the document payload
azure.textanalytics: PiiResult
Fields
- documents PiiDocumentEntities[] - Response by document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: PiiTask
Fields
- taskName? string -
- parameters? PiiTaskParameters -
azure.textanalytics: PiiTaskParameters
Fields
- domain "phi"|"none" (default "none") -
- piiCategories? PiiCategories - (Optional) describes the PII categories to return
- loggingOptOut boolean(default true) -
- modelVersion string(default "latest") -
- stringIndexType? StringIndexType -
azure.textanalytics: PiiTaskResult
Fields
- results? PiiResult -
azure.textanalytics: RecognizeEntitiesQueries
Represents the Queries record for the operation: recognizeEntities
Fields
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
- stringIndexType "TextElement_v8"|"UnicodeCodePoint"|"Utf16CodeUnit" (default "TextElement_v8") - (Optional) Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets
azure.textanalytics: RecognizePiiEntitiesQueries
Represents the Queries record for the operation: recognizePiiEntities
Fields
- showStats? boolean - (Optional) if set to true, response will contain request and document level statistics
- domain? string - (Optional) if specified, will set the PII domain to include only a subset of the entity categories. Possible values include: 'PHI', 'none'
- piiCategories? ("ABARoutingNumber"|"ARNationalIdentityNumber"|"AUBankAccountNumber"|"AUDriversLicenseNumber"|"AUMedicalAccountNumber"|"AUPassportNumber"|"AUTaxFileNumber"|"AUBusinessNumber"|"AUCompanyNumber"|"ATIdentityCard"|"ATTaxIdentificationNumber"|"ATValueAddedTaxNumber"|"AzureDocumentDBAuthKey"|"AzureIAASDatabaseConnectionAndSQLString"|"AzureIoTConnectionString"|"AzurePublishSettingPassword"|"AzureRedisCacheString"|"AzureSAS"|"AzureServiceBusString"|"AzureStorageAccountKey"|"AzureStorageAccountGeneric"|"BENationalNumber"|"BENationalNumberV2"|"BEValueAddedTaxNumber"|"BRCPFNumber"|"BRLegalEntityNumber"|"BRNationalIDRG"|"BGUniformCivilNumber"|"CABankAccountNumber"|"CADriversLicenseNumber"|"CAHealthServiceNumber"|"CAPassportNumber"|"CAPersonalHealthIdentification"|"CASocialInsuranceNumber"|"CLIdentityCardNumber"|"CNResidentIdentityCardNumber"|"CreditCardNumber"|"HRIdentityCardNumber"|"HRNationalIDNumber"|"HRPersonalIdentificationNumber"|"HRPersonalIdentificationOIBNumberV2"|"CYIdentityCard"|"CYTaxIdentificationNumber"|"CZPersonalIdentityNumber"|"CZPersonalIdentityV2"|"DKPersonalIdentificationNumber"|"DKPersonalIdentificationV2"|"DrugEnforcementAgencyNumber"|"EEPersonalIdentificationCode"|"EUDebitCardNumber"|"EUDriversLicenseNumber"|"EUGPSCoordinates"|"EUNationalIdentificationNumber"|"EUPassportNumber"|"EUSocialSecurityNumber"|"EUTaxIdentificationNumber"|"FIEuropeanHealthNumber"|"FINationalID"|"FINationalIDV2"|"FIPassportNumber"|"FRDriversLicenseNumber"|"FRHealthInsuranceNumber"|"FRNationalID"|"FRPassportNumber"|"FRSocialSecurityNumber"|"FRTaxIdentificationNumber"|"FRValueAddedTaxNumber"|"DEDriversLicenseNumber"|"DEPassportNumber"|"DEIdentityCardNumber"|"DETaxIdentificationNumber"|"DEValueAddedNumber"|"GRNationalIDCard"|"GRNationalIDV2"|"GRTaxIdentificationNumber"|"HKIdentityCardNumber"|"HUValueAddedNumber"|"HUPersonalIdentificationNumber"|"HUTaxIdentificationNumber"|"INPermanentAccount"|"INUniqueIdentificationNumber"|"IDIdentityCardNumber"|"InternationalBankingAccountNumber"|"IEPersonalPublicServiceNumber"|"IEPersonalPublicServiceNumberV2"|"ILBankAccountNumber"|"ILNationalID"|"ITDriversLicenseNumber"|"ITFiscalCode"|"ITValueAddedTaxNumber"|"JPBankAccountNumber"|"JPDriversLicenseNumber"|"JPPassportNumber"|"JPResidentRegistrationNumber"|"JPSocialInsuranceNumber"|"JPMyNumberCorporate"|"JPMyNumberPersonal"|"JPResidenceCardNumber"|"LVPersonalCode"|"LTPersonalCode"|"LUNationalIdentificationNumberNatural"|"LUNationalIdentificationNumberNonNatural"|"MYIdentityCardNumber"|"MTIdentityCardNumber"|"MTTaxIDNumber"|"NLCitizensServiceNumber"|"NLCitizensServiceNumberV2"|"NLTaxIdentificationNumber"|"NLValueAddedTaxNumber"|"NZBankAccountNumber"|"NZDriversLicenseNumber"|"NZInlandRevenueNumber"|"NZMinistryOfHealthNumber"|"NZSocialWelfareNumber"|"NOIdentityNumber"|"PHUnifiedMultiPurposeIDNumber"|"PLIdentityCard"|"PLNationalID"|"PLNationalIDV2"|"PLPassportNumber"|"PLTaxIdentificationNumber"|"PLREGONNumber"|"PTCitizenCardNumber"|"PTCitizenCardNumberV2"|"PTTaxIdentificationNumber"|"ROPersonalNumericalCode"|"RUPassportNumberDomestic"|"RUPassportNumberInternational"|"SANationalID"|"SGNationalRegistrationIdentityCardNumber"|"SKPersonalNumber"|"SITaxIdentificationNumber"|"SIUniqueMasterCitizenNumber"|"ZAIdentificationNumber"|"KRResidentRegistrationNumber"|"ESDNI"|"ESSocialSecurityNumber"|"ESTaxIdentificationNumber"|"SQLServerConnectionString"|"SENationalID"|"SENationalIDV2"|"SEPassportNumber"|"SETaxIdentificationNumber"|"SWIFTCode"|"CHSocialSecurityNumber"|"TWNationalID"|"TWPassportNumber"|"TWResidentCertificate"|"THPopulationIdentificationCode"|"TRNationalIdentificationNumber"|"UKDriversLicenseNumber"|"UKElectoralRollNumber"|"UKNationalHealthNumber"|"UKNationalInsuranceNumber"|"UKUniqueTaxpayerNumber"|"USUKPassportNumber"|"USBankAccountNumber"|"USDriversLicenseNumber"|"USIndividualTaxpayerIdentification"|"USSocialSecurityNumber"|"UAPassportNumberDomestic"|"UAPassportNumberInternational"|"Organization"|"Email"|"URL"|"Age"|"PhoneNumber"|"IPAddress"|"Date"|"Person"|"Address"|"All"|"Default")[] - (Optional) describes the PII categories to return
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
- stringIndexType "TextElement_v8"|"UnicodeCodePoint"|"Utf16CodeUnit" (default "TextElement_v8") - (Optional) Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets
azure.textanalytics: RequestStatistics
if showStats=true was specified in the request this field will contain information about the request payload
Fields
- documentsCount Signed32 - Number of documents submitted in the request
- erroneousDocumentsCount Signed32 - Number of invalid documents. This includes empty, over-size limit or non-supported languages documents
- validDocumentsCount Signed32 - Number of valid documents. This excludes empty, over-size limit or non-supported languages documents
- transactionsCount int - Number of transactions for the request
azure.textanalytics: SentenceAssessment
Fields
- sentiment "positive"|"mixed"|"negative" - Assessment sentiment in the sentence
- offset Signed32 - The assessment offset from the start of the sentence
- length Signed32 - The length of the assessment
- isNegated boolean - The indicator representing if the assessment is negated
- text string - The assessment text detected
- confidenceScores TargetConfidenceScoreLabel - Represents the confidence scores across all sentiment classes: positive, neutral, negative
azure.textanalytics: SentenceSentiment
Fields
- sentiment "positive"|"neutral"|"negative" - The predicted Sentiment for the sentence
- assessments? SentenceAssessment[] - The array of assessments for the sentence
- offset Signed32 - The sentence offset from the start of the document
- length Signed32 - The length of the sentence
- text string - The sentence text
- targets? SentenceTarget[] - The array of sentence targets for the sentence
- confidenceScores SentimentConfidenceScorePerLabel - Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative
azure.textanalytics: SentenceTarget
Fields
- sentiment "positive"|"mixed"|"negative" - Targeted sentiment in the sentence
- offset Signed32 - The target offset from the start of the sentence
- length Signed32 - The length of the target
- text string - The target text detected
- relations TargetRelation[] - The array of either assessment or target objects which is related to the target
- confidenceScores TargetConfidenceScoreLabel - Represents the confidence scores across all sentiment classes: positive, neutral, negative
azure.textanalytics: SentimentAnalysisTask
Fields
- taskName? string -
- parameters? SentimentAnalysisTaskParameters -
azure.textanalytics: SentimentAnalysisTaskParameters
Fields
- opinionMining boolean(default false) -
- loggingOptOut boolean(default false) -
- modelVersion string(default "latest") -
- stringIndexType? StringIndexType -
azure.textanalytics: SentimentConfidenceScorePerLabel
Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative
Fields
- negative decimal -
- neutral decimal -
- positive decimal -
azure.textanalytics: SentimentResponse
Fields
- documents DocumentSentiment[] - Sentiment analysis per document
- modelVersion string - This field indicates which model is used for scoring
- errors DocumentError[] - Errors by document id
- statistics? RequestStatistics - if showStats=true was specified in the request this field will contain information about the request payload
azure.textanalytics: SentimentTaskResult
Fields
- results? SentimentResponse -
azure.textanalytics: SubmitHealthcareJobQueries
Represents the Queries record for the operation: submitHealthcareJob
Fields
- loggingOptOut? boolean - (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in providing you with the Text Analytics natural language processing functions. Setting this parameter to true, disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai
- modelVersion? string - (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version.
- stringIndexType "TextElement_v8"|"UnicodeCodePoint"|"Utf16CodeUnit" (default "TextElement_v8") - (Optional) Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets
azure.textanalytics: TargetConfidenceScoreLabel
Represents the confidence scores across all sentiment classes: positive, neutral, negative
Fields
- negative decimal -
- positive decimal -
azure.textanalytics: TargetRelation
Fields
- relationType "assessment"|"target" - The type related to the target
- ref string - The JSON pointer indicating the linked object
azure.textanalytics: TasksState
Fields
- tasks TasksStateTasks -
azure.textanalytics: TasksStateTasks
Fields
- total int -
- entityRecognitionTasks? TasksStateTasksEntityRecognitionTasks[] -
- entityRecognitionPiiTasks? TasksStateTasksEntityRecognitionPiiTasks[] -
- inProgress int -
- entityLinkingTasks? TasksStateTasksEntityLinkingTasks[] -
- completed int -
- failed int -
- keyPhraseExtractionTasks? TasksStateTasksKeyPhraseExtractionTasks[] -
- sentimentAnalysisTasks? TasksStateTasksSentimentAnalysisTasks[] -
azure.textanalytics: TasksStateTasksEntityLinkingTasks
Fields
- Fields Included from *TaskState
- Fields Included from *EntityLinkingTaskResult
- results EntityLinkingResult
- anydata...
azure.textanalytics: TasksStateTasksEntityRecognitionPiiTasks
Fields
- Fields Included from *TaskState
- Fields Included from *PiiTaskResult
- results PiiResult
- anydata...
azure.textanalytics: TasksStateTasksEntityRecognitionTasks
Fields
- Fields Included from *TaskState
- Fields Included from *EntitiesTaskResult
- results EntitiesResult
- anydata...
azure.textanalytics: TasksStateTasksKeyPhraseExtractionTasks
Fields
- Fields Included from *TaskState
- Fields Included from *KeyPhraseTaskResult
- results KeyPhraseResult
- anydata...
azure.textanalytics: TasksStateTasksSentimentAnalysisTasks
Fields
- Fields Included from *TaskState
- Fields Included from *SentimentTaskResult
- results SentimentResponse
- anydata...
azure.textanalytics: TaskState
Fields
- lastUpdateDateTime string -
- taskName string -
- status "notStarted"|"running"|"succeeded"|"failed"|"rejected"|"cancelled"|"cancelling" -
azure.textanalytics: TextAnalyticsError
Fields
- code string - Error code. Known values: InvalidRequest, InvalidArgument, InternalServerError, ServiceUnavailable, NotFound
- innererror? InnerError -
- details? TextAnalyticsError[] - Details about specific errors that led to this reported error
- message string - Error message
- target? string - Error target
azure.textanalytics: TextAnalyticsWarning
Fields
- targetRef? string - A JSON pointer reference indicating the target object
- code string - Warning code. Known values: LongWordsInDocument, DocumentTruncated
- message string - Warning message
Union types
azure.textanalytics: StringIndexType
StringIndexType
Array types
azure.textanalytics: PiiCategories
PiiCategories
(Optional) describes the PII categories to return
Import
import ballerinax/azure.textanalytics;Metadata
Released date: 1 day ago
Version: 2.0.0
License: Apache-2.0
Security
Direct vulnerabilities: No known direct vulnerabilities
Indirect vulnerabilities:
Checked on 2026-11-21 via OSV.dev
Compatibility
Platform: any
Ballerina version: 2201.12.0
GraalVM compatible: Yes
Pull count
Total: 108
Current verison: 1
Weekly downloads
Keywords
Vendor/Microsoft
Area/AI & Machine Learning
Type/Connector
Contributors