@azure/ai-text-analytics package

Classes

AzureKeyCredential

A static-key-based credential that supports updating the underlying key value.

TextAnalysisClient

A client for interacting with the text analysis features in Azure Cognitive Language Service.

The client needs the endpoint of a Language resource and an authentication method such as an API key or AAD. The API key and endpoint can be found in the Language resource page in the Azure portal. They will be located in the resource's Keys and Endpoint page, under Resource Management.

Examples for authentication:

API Key

import { TextAnalysisClient, AzureKeyCredential } from "@azure/ai-text-analytics";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new AzureKeyCredential("<api key>");

const client = new TextAnalysisClient(endpoint, credential);

Azure Active Directory

See the @azure/identity package for more information about authenticating with Azure Active Directory.

import { TextAnalysisClient } from "@azure/ai-text-analytics";
import { DefaultAzureCredential } from "@azure/identity";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new DefaultAzureCredential();

const client = new TextAnalysisClient(endpoint, credential);

Interfaces

ActionCommon

Configuration common to all actions.

ActionMetadata

Action metadata.

AnalyzeBatchActionCommon

Options common to all batch actions.

AnalyzeBatchOperationMetadata

The metadata for long-running operations started by beginAnalyzeBatch.

AnalyzeBatchOperationState

The state of the begin analyze polling operation.

AssessmentSentiment

An object that contains the predicted sentiment, confidence scores and other information about an assessment of a target. For example, in the sentence "The food is good", the assessment of the target 'food' is 'good'.

BatchActionErrorResult

The error of an analyze batch action.

BatchActionState

The State of a batched action

BatchActionSuccessResult

The state of a succeeded batched action.

BeginAnalyzeBatchOptions

Options for the begin analyze actions operation.

ClassificationCategory

A classification result from a custom classify document single category action

CustomActionMetadata

Custom action metadata.

CustomEntityRecognitionBatchAction

Options for a custom entity recognition batch action.

CustomEntityRecognitionSuccessResult

The result of the recognize custom entities operation on a single document, containing a collection of the entities identified in that document.

CustomMultiLabelClassificationBatchAction

Options for a custom multi-label classification batch action.

CustomMultiLabelClassificationSuccessResult

The result of the custom classify document multi categories operation on a multi document, containing the result of the classification.

CustomSingleLabelClassificationBatchAction

Options for a custom single-label classification batch action.

CustomSingleLabelClassificationSuccessResult

The result of the custom classify document single category operation on a single document, containing the result of the classification.

DetectedLanguage

Information about the language of a document as identified by the Language service.

DocumentWarning

Represents a warning encountered while processing a document.

Entity

A word or phrase identified as an entity that is categorized within a taxonomy of types. The set of categories recognized by the Language service is described at https://docs.microsoft.com/azure/cognitive-services/language-service/named-entity-recognition/concepts/named-entity-categories .

EntityDataSource

A type representing a reference for the healthcare entity into a specific entity catalog.

EntityLinkingBatchAction

Options for an entity linking batch action.

EntityLinkingSuccessResult

The result of a entity linking action on a single document, containing a collection of the LinkedEntity objects identified in that document.

EntityRecognitionBatchAction

Options for an entity recognition batch action.

EntityRecognitionSuccessResult

The result of an entity recognition action on a single document, containing a collection of Entity objects identified in that document.

ExtractiveSummarizationBatchAction

Options for an extractive summarization batch action.

HealthcareAssertion

An object that describes metadata about the healthcare entity such as whether it is hypothetical or conditional.

HealthcareBatchAction

Options for a healthcare batch action.

HealthcareEntity

A healthcare entity represented as a node in a directed graph where the edges are a particular type of relationship between the source and target nodes.

HealthcareEntityRelation

A relationship between two or more healthcare entities.

HealthcareEntityRelationRole

A healthcare entity that plays a specific role in a relation.

HealthcareSuccessResult

The results of a successful healthcare operation for a single document.

KeyPhraseExtractionBatchAction

Options for an key phrase extraction batch action.

KeyPhraseExtractionSuccessResult

The result of a key phrase extraction action on a single document, containing a collection of the key phrases identified in that document.

LanguageDetectionInput

An input to the language detection operation. This object specifies a unique document id, as well as the full text of a document and a hint indicating the document's country of origin to assist the Language predictive model in detecting the document's language.

LanguageDetectionSuccessResult

The result of a language detection action on a single document, containing a prediction of what language the document is written in.

LinkedEntity

A word or phrase identified as a well-known entity within a database, including its formal (disambiguated) name and a link to the entity information within the source database.

Match

Details about the specific substring in a document that refers to a linked entity identified by the Language model.

Opinion

A mined opinion object represents an opinion we've extracted from a sentence. It consists of both a target that these assessments are about, and the actual assessments themselves.

PiiEntityRecognitionBatchAction

Options for a pii entity recognition batch action.

PiiEntityRecognitionSuccessResult

The result of a pii entity recognition action on a single document, containing the collection of Entity objects identified in that document.

RestoreAnalyzeBatchPollerOptions

Options for the begin analyze actions operation.

SentenceSentiment

The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://docs.microsoft.com//azure/cognitive-services/language-service/sentiment-opinion-mining/overview.

SentimentAnalysisBatchAction

Options for a sentiment analysis batch action.

SentimentAnalysisSuccessResult

The result of a sentiment analysis action on a single document, containing the predicted sentiment for each sentence as well as for the full document.

SentimentConfidenceScores

Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative.

SummarizationExtractionSuccessResult

The result of the summarization extraction action on a single document, containing a collection of the summary identified in that document.

SummarySentence

A sentence that is part of the extracted summary.

TargetConfidenceScores

Represents the confidence scores across all sentiment classes: positive, neutral, negative.

TargetSentiment

TargetSentiment contains the predicted sentiment, confidence scores and other information about a target of a product. A target of a product/service is a key component of that product/service. For example in "The food at Hotel Foo is good", "food" is a target of "Hotel Foo".

TextAnalysisClientOptions

Configuration options for TextAnalysisClient.

TextAnalysisError

Type describing an API error.

TextAnalysisErrorResult

Base type for error results of an action corresponding to a single document.

TextAnalysisOperationOptions

Options common to all operations.

TextAnalysisSuccessResult

Base type for results of an action corresponding to a single input document.

TextDocumentBatchStatistics

if includeStatistics=true was specified in the request this field will contain information about the request payload.

TextDocumentInput

An object representing an individual text document to be analyzed by the Language service. The document contains a unique document ID, the full text of the document, and the language of the document's text.

TextDocumentStatistics

if includeStatistics=true was specified in the request this field will contain information about the document payload.

Type Aliases

ActionCustom

Parameters object for a text analysis task using custom models.

ActionPrebuilt

Configuration common to all actions that use prebuilt models.

AnalyzeActionName

Type of actions supported by the analyze method.

AnalyzeActionParameters

The type of parameters for every action in $AnalyzeActionNames.

AnalyzeBatchAction

Batch of actions.

AnalyzeBatchActionName

Type of actions supported by the beginAnalyzeBatch method.

AnalyzeBatchPoller

A poller that polls long-running operations started by beginAnalyzeBatch.

AnalyzeBatchResult

Results of a batch of actions.

AnalyzeResult

The type of results of every action in $AnalyzeActionNames.

BatchActionResult

The result of a batched action.

CustomEntityRecognitionAction

Supported parameters for a Custom Entities task.

CustomEntityRecognitionBatchResult

The result of a custom entity recognition batch action.

CustomEntityRecognitionErrorResult

An error result from the recognize custom entities operation on a single document.

CustomEntityRecognitionResult

The result of the custom recognize entities operation on a single document.

CustomMultiLabelClassificationAction

Options for a multi-label classification custom action

CustomMultiLabelClassificationBatchResult

The result of a custom multi-label classification batch action.

CustomMultiLabelClassificationErrorResult

An error result from the custom classify document multi category operation on a multi document.

CustomMultiLabelClassificationResult

The result of the custom classify document multi categories operation on a multi document.

CustomSingleLabelClassificationAction

Options for a single-label classification custom action

CustomSingleLabelClassificationBatchResult

The result of a custom single-label classification batch action.

CustomSingleLabelClassificationErrorResult

An error result from the custom classify document single category operation on a single document.

CustomSingleLabelClassificationResult

The result of the custom classify document single category operation on a single document.

DocumentSentimentLabel

Defines values for DocumentSentimentLabel.

EntityAssociation

Defines values for EntityAssociation.

EntityCertainty

Defines values for EntityCertainty.

EntityConditionality

Defines values for EntityConditionality.

EntityLinkingAction

Options for an entity linking action.

EntityLinkingBatchResult

The result of an entity linking batch action.

EntityLinkingErrorResult

An error result from an entity linking action on a single document.

EntityLinkingResult

The result of an entity linking action on a single document.

EntityRecognitionAction

Options for an entity recognition action.

EntityRecognitionBatchResult

The result of an entity recognition batch action.

EntityRecognitionErrorResult

An error result from an entity recognition action on a single document.

EntityRecognitionResult

The result of an entity recognition action on a single document.

ExtractiveSummarizationAction

Supported parameters for an Extractive Summarization task.

ExtractiveSummarizationBatchResult

The result of an extractive summarization batch action.

ExtractiveSummarizationOrderingCriteria

Defines values for ExtractiveSummarizationOrderingCriteria.
KnownExtractiveSummarizationOrderingCriteria can be used interchangeably with ExtractiveSummarizationOrderingCriteria, this enum contains the known values that the service supports.

Known values supported by the service

Offset: Indicates that results should be sorted in order of appearance in the text.
Rank: Indicates that results should be sorted in order of importance (i.e. rank score) according to the model.

FhirVersion

Defines values for FhirVersion.
KnownFhirVersion can be used interchangeably with FhirVersion, this enum contains the known values that the service supports.

Known values supported by the service

4.0.1

HealthcareAction

Supported parameters for a Healthcare task.

HealthcareBatchResult

The result of a healthcare batch action.

HealthcareEntityCategory

Defines values for HealthcareEntityCategory.
<xref:KnownHealthcareEntityCategory> can be used interchangeably with HealthcareEntityCategory, this enum contains the known values that the service supports.

Known values supported by the service

BODY_STRUCTURE
AGE
GENDER
EXAMINATION_NAME
DATE
DIRECTION
FREQUENCY
MEASUREMENT_VALUE
MEASUREMENT_UNIT
RELATIONAL_OPERATOR
TIME
GENE_OR_PROTEIN
VARIANT
ADMINISTRATIVE_EVENT
CARE_ENVIRONMENT
HEALTHCARE_PROFESSION
DIAGNOSIS
SYMPTOM_OR_SIGN
CONDITION_QUALIFIER
MEDICATION_CLASS
MEDICATION_NAME
DOSAGE
MEDICATION_FORM
MEDICATION_ROUTE
FAMILY_RELATION
TREATMENT_NAME

HealthcareEntityRelationRoleType

The type of different roles a healthcare entity can play in a relation.

HealthcareErrorResult

An error result from the healthcare operation on a single document.

HealthcareResult

The result of the healthcare operation on a single document.

KeyPhraseExtractionAction

Options for a key phrase recognition action.

KeyPhraseExtractionBatchResult

The result of a key phrase extraction batch action.

KeyPhraseExtractionErrorResult

An error result from a key phrase extraction action on a single document.

KeyPhraseExtractionResult

The result of a sentiment analysis action on a single document.

LanguageDetectionAction

Options for a language detection action.

LanguageDetectionErrorResult

An error result from a language detection action on a single document.

LanguageDetectionResult

The result of a language detection action on a single document.

OperationStatus

Defines values for OperationStatus.

PagedAnalyzeBatchResult

Paged results of the beginAnalyzeBatch operation.

PiiEntityCategory

Defines values for PiiEntityCategory.
KnownPiiEntityCategory can be used interchangeably with PiiEntityCategory, this enum contains the known values that the service supports.

Known values supported by the service

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

PiiEntityDomain

Defines values for PiiEntityDomain.
KnownPiiEntityDomain can be used interchangeably with PiiEntityDomain, this enum contains the known values that the service supports.

Known values supported by the service

phi: Indicates that entities in the Personal Health Information domain should be redacted.
none: Indicates that no domain is specified.

PiiEntityRecognitionAction

Options for a Pii entity recognition action.

PiiEntityRecognitionBatchResult

The result of a pii entity recognition batch action.

PiiEntityRecognitionErrorResult

An error result from a pii entity recognition action on a single document.

PiiEntityRecognitionResult

The result of an entity recognition action on a single document.

RelationType

Defines values for RelationType.
<xref:KnownRelationType> can be used interchangeably with RelationType, this enum contains the known values that the service supports.

Known values supported by the service

Abbreviation
DirectionOfBodyStructure
DirectionOfCondition
DirectionOfExamination
DirectionOfTreatment
DosageOfMedication
FormOfMedication
FrequencyOfMedication
FrequencyOfTreatment
QualifierOfCondition
RelationOfExamination
RouteOfMedication
TimeOfCondition
TimeOfEvent
TimeOfExamination
TimeOfMedication
TimeOfTreatment
UnitOfCondition
UnitOfExamination
ValueOfCondition
ValueOfExamination

SentenceSentimentLabel

Defines values for SentenceSentimentLabel.

SentimentAnalysisAction

Options for a sentiment analysis action.

SentimentAnalysisBatchResult

The result of a sentiment analysis batch action.

SentimentAnalysisErrorResult

An error result from a sentiment analysis action on a single document.

SentimentAnalysisResult

The result of a sentiment analysis action on a single document.

StringIndexType

Defines values for StringIndexType.
KnownStringIndexType can be used interchangeably with StringIndexType, this enum contains the known values that the service supports.

Known values supported by the service

TextElements_v8: Returned offset and length values will correspond to TextElements (Graphemes and Grapheme clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is written in .Net Framework or .Net Core and you will be using StringInfo.
UnicodeCodePoint: Returned offset and length values will correspond to Unicode code points. Use this option if your application is written in a language that support Unicode, for example Python.
Utf16CodeUnit: Returned offset and length values will correspond to UTF-16 code units. Use this option if your application is written in a language that support Unicode, for example Java, JavaScript.

SummarizationExtractionErrorResult

An error result from the extract summary operation on a single document.

SummarizationExtractionResult

The result of the extract summary operation on a single document.

TokenSentimentLabel

Defines values for TokenSentimentLabel.

WarningCode

Defines values for WarningCode.
<xref:KnownWarningCode> can be used interchangeably with WarningCode, this enum contains the known values that the service supports.

Known values supported by the service

LongWordsInDocument
DocumentTruncated

Enums

KnownErrorCode

Known values of KnownErrorCode that the service accepts.

KnownExtractiveSummarizationOrderingCriteria

Known values of ExtractiveSummarizationOrderingCriteria that the service accepts.

KnownFhirVersion

Known values of the <xref:HealthcareAction.fhirVersion> parameter.

KnownInnerErrorCode

Known values of KnownInnerErrorCode that the service accepts.

KnownPiiEntityCategory

Known values of PiiEntityCategory that the service accepts.

KnownPiiEntityDomain

Known values of PiiEntityDomain that the service accepts.

KnownStringIndexType

Known values of StringIndexType that the service accepts.