@azure/ai-text-analytics
Version:
An isomorphic client library for the Azure Text Analytics service.
1,391 lines (1,287 loc) • 73.2 kB
TypeScript
import { AzureKeyCredential } from '@azure/core-auth';
import { CommonClientOptions } from '@azure/core-client';
import { KeyCredential } from '@azure/core-auth';
import { OperationOptions } from '@azure/core-client';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
import { PollerLike } from '@azure/core-lro';
import { PollOperationState } from '@azure/core-lro';
import { TokenCredential } from '@azure/core-auth';
/**
* An interface representing the state of an analysis poller operation.
*/
export declare interface AnalysisPollOperationState<TResult> extends PollOperationState<TResult>, OperationMetadata {
}
/**
* The metadata for beginAnalyzeActions operations.
*/
export declare interface AnalyzeActionsOperationMetadata extends OperationMetadata {
/**
* Number of successfully completed actions.
*/
actionsSucceededCount: number;
/**
* Number of failed actions.
*/
actionsFailedCount: number;
/**
* Number of actions still in progress.
*/
actionsInProgressCount: number;
/**
* The operation's display name.
*/
displayName?: string;
}
/**
* The state of the begin analyze polling operation.
*/
export declare interface AnalyzeActionsOperationState extends AnalysisPollOperationState<PagedAnalyzeActionsResult>, AnalyzeActionsOperationMetadata {
}
/**
* Result type of the Begin Analyze Actions Long-Running-Operation (LRO).
*/
export declare type AnalyzeActionsPollerLike = PollerLike<AnalyzeActionsOperationState, PagedAnalyzeActionsResult>;
/**
* The results of an analyze Actions operation.
*/
export declare interface AnalyzeActionsResult {
/**
* Array of the results for each categorized entities recognition action.
*/
recognizeEntitiesResults: RecognizeCategorizedEntitiesActionResult[];
/**
* Array of the results for each Pii entities recognition action.
*/
recognizePiiEntitiesResults: RecognizePiiEntitiesActionResult[];
/**
* Array of the results for each key phrases extraction action.
*/
extractKeyPhrasesResults: ExtractKeyPhrasesActionResult[];
/**
* Array of the results for each linked entities recognition action.
*/
recognizeLinkedEntitiesResults: RecognizeLinkedEntitiesActionResult[];
/**
* Array of the results for each analyze sentiment action.
*/
analyzeSentimentResults: AnalyzeSentimentActionResult[];
}
/**
* An error result from the healthcare operation on a single document.
*/
export declare type AnalyzeHealthcareEntitiesErrorResult = TextAnalyticsErrorResult;
/**
* Result type of the Health Long-Running-Operation (LRO)
*/
export declare type AnalyzeHealthcareEntitiesPollerLike = PollerLike<AnalyzeHealthcareOperationState, PagedAnalyzeHealthcareEntitiesResult>;
/**
* The result of the healthcare operation on a single document.
*/
export declare type AnalyzeHealthcareEntitiesResult = AnalyzeHealthcareEntitiesSuccessResult | AnalyzeHealthcareEntitiesErrorResult;
/**
* Array of {@link AnalyzeHealthcareEntitiesResult}
*/
export declare interface AnalyzeHealthcareEntitiesResultArray extends Array<AnalyzeHealthcareEntitiesResult> {
}
/**
* The results of a successful healthcare operation for a single document.
*/
export declare interface AnalyzeHealthcareEntitiesSuccessResult extends TextAnalyticsSuccessResult {
/**
* Healthcare entities.
*/
entities: HealthcareEntity[];
/**
* Relations between healthcare entities.
*/
entityRelations: HealthcareEntityRelation[];
}
/**
* The state of the begin analyze healthcare polling operation.
*/
export declare interface AnalyzeHealthcareOperationState extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {
}
/**
* Options for an analyze sentiment action.
*/
export declare interface AnalyzeSentimentAction extends TextAnalyticsAction {
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
/**
* 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. Setting this parameter to true,
* disables input logging and may limit our ability to remediate issues that occur.
*/
disableServiceLogs?: boolean;
/**
* Whether to mine the opinions of a sentence and conduct more granular
* analysis around the aspects of a product or service (also known as
* aspect-based sentiment analysis). If set to true, the returned
* `SentenceSentiment` objects will have property `opinions` containing
* the result of this analysis.
* More information about the feature can be found here: {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}
*/
includeOpinionMining?: boolean;
}
/**
* The error of an analyze sentiment action.
*/
export declare type AnalyzeSentimentActionErrorResult = TextAnalyticsActionErrorResult;
/**
* The result of an analyze sentiment action.
*/
export declare type AnalyzeSentimentActionResult = AnalyzeSentimentActionSuccessResult | AnalyzeSentimentActionErrorResult;
/**
* The results of a succeeded analyze sentiment action.
*/
export declare interface AnalyzeSentimentActionSuccessResult extends TextAnalyticsActionSuccessState {
/**
* Array of the results for each analyze sentiment action.
*/
results: AnalyzeSentimentResultArray;
}
/**
* An error result from the analyze sentiment operation on a single document.
*/
export declare type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult;
/**
* Options for the analyze sentiment operation.
*/
export declare interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {
/**
* Whether to mine the opinions of a sentence and conduct more granular
* analysis around the aspects of a product or service (also known as
* aspect-based sentiment analysis). If set to true, the returned
* `SentenceSentiment` objects will have property `opinions` containing
* the result of this analysis.
* More information about the feature can be found here: {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}
*/
includeOpinionMining?: boolean;
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
}
/**
* The result of the analyze sentiment operation on a single document.
*/
export declare type AnalyzeSentimentResult = AnalyzeSentimentSuccessResult | AnalyzeSentimentErrorResult;
/**
* Array of `AnalyzeSentimentResult` objects corresponding to a batch of input documents, and
* annotated with information about the batch operation.
*/
export declare interface AnalyzeSentimentResultArray extends Array<AnalyzeSentimentResult> {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The result of the analyze sentiment operation on a single document,
* containing the predicted sentiment for each sentence as well as for the full document.
*/
export declare interface AnalyzeSentimentSuccessResult extends TextAnalyticsSuccessResult {
/**
* Predicted sentiment for document. Possible values
* include: 'positive', 'neutral', 'negative', 'mixed'
*/
sentiment: DocumentSentimentLabel;
/**
* Document level sentiment confidence scores between 0 and 1 for each sentiment class.
*/
confidenceScores: SentimentConfidenceScores;
/**
* The predicted sentiment for each sentence in the corresponding document.
*/
sentences: SentenceSentiment[];
}
/**
* AssessmentSentiment 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'.
*/
export declare interface AssessmentSentiment extends SentenceAssessment {
}
export { AzureKeyCredential }
/**
* Options for the begin analyze actions operation.
*/
export declare interface BeginAnalyzeActionsOptions extends OperationOptions {
/**
* Delay to wait until next poll, in milliseconds.
*/
updateIntervalInMs?: number;
/**
* A serialized poller which can be used to resume an existing paused Long-Running-Operation.
*/
resumeFrom?: string;
/**
* If set to true, response will contain input and document level statistics.
*/
includeStatistics?: boolean;
/**
* The operation's display name.
*/
displayName?: string;
}
/**
* Options for the begin analyze healthcare entities operation.
*/
export declare interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnalyticsOperationOptions {
/**
* Delay to wait until next poll, in milliseconds.
*/
stringIndexType?: StringIndexType;
/**
* Delay to wait until next poll, in milliseconds.
*/
updateIntervalInMs?: number;
/**
* A serialized poller which can be used to resume an existing paused Long-Running-Operation.
*/
resumeFrom?: string;
}
/**
* An entity from text analysis with information about its categorical
* classification.
*/
export declare interface CategorizedEntity extends Entity {
}
/** Information about the language of a document as identified by the Text Analytics service. */
export declare interface DetectedLanguage {
/** Long name of a detected language (e.g. English, French). */
name: string;
/** A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). */
iso6391Name: string;
/** A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. */
confidenceScore: number;
}
/**
* An error result from the detect languge operation on a single document.
*/
export declare type DetectLanguageErrorResult = TextAnalyticsErrorResult;
/** 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 text analytics predictive model in detecting the document's language. */
export declare interface DetectLanguageInput {
/** Unique, non-empty document identifier. */
id: string;
text: string;
countryHint?: string;
}
/**
* Options for the detect languages operation.
*/
export declare interface DetectLanguageOptions extends TextAnalyticsOperationOptions {
}
/**
* The result of the detect language operation on a single document.
*/
export declare type DetectLanguageResult = DetectLanguageSuccessResult | DetectLanguageErrorResult;
/**
* Array of `DetectLanguageResult` objects corresponding to a batch of input documents, and
* annotated with information about the batch operation.
*/
export declare interface DetectLanguageResultArray extends Array<DetectLanguageResult> {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The result of the detect language operation on a single document,
* containing a prediction of what language the document is written in.
*/
export declare interface DetectLanguageSuccessResult extends TextAnalyticsSuccessResult {
/**
* The top detected language by confidence score.
*/
readonly primaryLanguage: DetectedLanguage;
}
/** Defines values for DocumentSentimentLabel. */
export declare type DocumentSentimentLabel = "positive" | "neutral" | "negative" | "mixed";
/** A word or phrase identified as an entity that is categorized within a taxonomy of types. The set of categories recognized by the Text Analytics service is described at https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types . */
export declare interface Entity {
/** Entity text as appears in the request. */
text: string;
/** Entity type. */
category: string;
/** (Optional) Entity sub type. */
subCategory?: string;
/** Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. */
offset: number;
/** Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. */
length: number;
/** Confidence score between 0 and 1 of the extracted entity. */
confidenceScore: number;
}
export declare interface EntityAssertion {
/** Describes any conditionality on the entity. */
conditionality?: EntityConditionality;
/** Describes the entities certainty and polarity. */
certainty?: EntityCertainty;
/** Describes if the entity is the subject of the text or if it describes someone else. */
association?: EntityAssociation;
}
/** Defines values for Association. */
export declare type EntityAssociation = "subject" | "other";
/** Defines values for Certainty. */
export declare type EntityCertainty = "positive" | "positivePossible" | "neutralPossible" | "negativePossible" | "negative";
/** Defines values for Conditionality. */
export declare type EntityConditionality = "hypothetical" | "conditional";
/**
* A type representing a reference for the healthcare entity into a specific
* entity catalog.
*/
export declare interface EntityDataSource {
/**
* Entity Catalog. Examples include: UMLS, CHV, MSH, etc.
*/
name: string;
/**
* Entity id in the given source catalog.
*/
entityId: string;
}
/**
* An Error Code returned from the Text Analytics service. Possible
* values include:
*
* For more information about the error, see the `message` property of the associated error.
*/
export declare type ErrorCode = ErrorCodeValue | InnerErrorCodeValue;
/**
* Defines values for ErrorCodeValue. \
* {@link KnownErrorCodeValue} can be used interchangeably with ErrorCodeValue,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **InvalidRequest** \
* **InvalidArgument** \
* **InternalServerError** \
* **ServiceUnavailable** \
* **NotFound**
*/
export declare type ErrorCodeValue = string;
/**
* Options for a key phrases recognition action.
*/
export declare interface ExtractKeyPhrasesAction extends TextAnalyticsAction {
/**
* If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics
* will not log your input text for pii entities recognition. Setting this parameter to false,
* enables input logging.
*/
disableServiceLogs?: boolean;
}
/**
* The error of a extract key phrases action.
*/
export declare type ExtractKeyPhrasesActionErrorResult = TextAnalyticsActionErrorResult;
/**
* The result of a extract key phrases action.
*/
export declare type ExtractKeyPhrasesActionResult = ExtractKeyPhrasesActionSuccessResult | ExtractKeyPhrasesActionErrorResult;
/**
* The results of a succeeded extract key phrases action.
*/
export declare interface ExtractKeyPhrasesActionSuccessResult extends TextAnalyticsActionSuccessState {
/**
* Array of the results for each extract key phrases action.
*/
results: ExtractKeyPhrasesResultArray;
}
/**
* An error result from the extract key phrases operation on a single document.
*/
export declare type ExtractKeyPhrasesErrorResult = TextAnalyticsErrorResult;
/**
* Options for the extract key phrases operation.
*/
export declare interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {
}
/**
* The result of the extract key phrases operation on a single document.
*/
export declare type ExtractKeyPhrasesResult = ExtractKeyPhrasesSuccessResult | ExtractKeyPhrasesErrorResult;
/**
* Array of `ExtractKeyPhrasesResult` objects corresponding to a batch of input documents, and
* annotated with information about the batch operation.
*/
export declare interface ExtractKeyPhrasesResultArray extends Array<ExtractKeyPhrasesResult> {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The result of the extract key phrases operation on a single document,
* containing a collection of the key phrases identified in that document.
*/
export declare interface ExtractKeyPhrasesSuccessResult extends TextAnalyticsSuccessResult {
/**
* A list of representative words or phrases. The number of key phrases returned is proportional
* to the number of words in the input document.
*/
keyPhrases: string[];
}
/**
* 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.
*/
export declare interface HealthcareEntity extends Entity {
/**
* Normalized name for the entity. For example, the normalized text for "histologically" is "histologic".
*/
normalizedText?: string;
/**
* Whether the entity is negated.
*/
assertion?: EntityAssertion;
/**
* Entity references in known data sources.
*/
dataSources: EntityDataSource[];
/**
* Defines values for HealthcareEntityCategory.
* {@link 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**
*/
category: HealthcareEntityCategory;
}
/**
* Defines values for HealthcareEntityCategory. \
* {@link 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**
*/
export declare type HealthcareEntityCategory = string;
/**
* A relationship between two or more healthcare entities.
*/
export declare interface HealthcareEntityRelation {
/**
* The type of the healthcare relation.
*/
relationType: HealthcareEntityRelationType;
/**
* The list of healthcare entities and their roles in the healthcare relation.
*/
roles: HealthcareEntityRelationRole[];
}
/**
* A healthcare entity that plays a specific role in a relation.
*/
export declare interface HealthcareEntityRelationRole {
/**
* A healthcare entity
*/
entity: HealthcareEntity;
/**
* The role of the healthcare entity in a particular relation.
*/
name: HealthcareEntityRelationRoleType;
}
/**
* The type of different roles a healthcare entity can play in a relation.
*/
export declare type HealthcareEntityRelationRoleType = string;
/**
* Defines values for RelationType. \
* {@link 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**
*/
export declare type HealthcareEntityRelationType = string;
/**
* Defines values for InnerErrorCodeValue. \
* {@link KnownInnerErrorCodeValue} can be used interchangeably with InnerErrorCodeValue,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **InvalidParameterValue** \
* **InvalidRequestBodyFormat** \
* **EmptyRequest** \
* **MissingInputRecords** \
* **InvalidDocument** \
* **ModelVersionIncorrect** \
* **InvalidDocumentBatch** \
* **UnsupportedLanguageCode** \
* **InvalidCountryHint**
*/
export declare type InnerErrorCodeValue = string;
/** Known values of {@link HealthcareEntityCategory} that the service accepts. */
export declare const enum KnownHealthcareEntityCategory {
BodyStructure = "BODY_STRUCTURE",
AGE = "AGE",
Gender = "GENDER",
ExaminationName = "EXAMINATION_NAME",
Date = "DATE",
Direction = "DIRECTION",
Frequency = "FREQUENCY",
MeasurementValue = "MEASUREMENT_VALUE",
MeasurementUnit = "MEASUREMENT_UNIT",
RelationalOperator = "RELATIONAL_OPERATOR",
Time = "TIME",
GeneORProtein = "GENE_OR_PROTEIN",
Variant = "VARIANT",
AdministrativeEvent = "ADMINISTRATIVE_EVENT",
CareEnvironment = "CARE_ENVIRONMENT",
HealthcareProfession = "HEALTHCARE_PROFESSION",
Diagnosis = "DIAGNOSIS",
SymptomORSign = "SYMPTOM_OR_SIGN",
ConditionQualifier = "CONDITION_QUALIFIER",
MedicationClass = "MEDICATION_CLASS",
MedicationName = "MEDICATION_NAME",
Dosage = "DOSAGE",
MedicationForm = "MEDICATION_FORM",
MedicationRoute = "MEDICATION_ROUTE",
FamilyRelation = "FAMILY_RELATION",
TreatmentName = "TREATMENT_NAME"
}
/** Known values of {@link InnerErrorCodeValue} that the service accepts. */
export declare const enum KnownInnerErrorCodeValue {
InvalidParameterValue = "InvalidParameterValue",
InvalidRequestBodyFormat = "InvalidRequestBodyFormat",
EmptyRequest = "EmptyRequest",
MissingInputRecords = "MissingInputRecords",
InvalidDocument = "InvalidDocument",
ModelVersionIncorrect = "ModelVersionIncorrect",
InvalidDocumentBatch = "InvalidDocumentBatch",
UnsupportedLanguageCode = "UnsupportedLanguageCode",
InvalidCountryHint = "InvalidCountryHint"
}
/** Known values of {@link WarningCode} that the service accepts. */
export declare const enum KnownWarningCode {
LongWordsInDocument = "LongWordsInDocument",
DocumentTruncated = "DocumentTruncated"
}
/** 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. */
export declare interface LinkedEntity {
/** Entity Linking formal name. */
name: string;
/** List of instances this entity appears in the text. */
matches: Match[];
/** Language used in the data source. */
language: string;
/** Unique identifier of the recognized entity from the data source. */
dataSourceEntityId?: string;
/** URL for the entity's page from the data source. */
url: string;
/** Data source used to extract entity linking, such as Wiki/Bing etc. */
dataSource: string;
/** Bing Entity Search API unique identifier of the recognized entity. */
bingEntitySearchApiId?: string;
}
/** Details about the specific substring in a document that refers to a linked entity identified by the Text Analytics model. */
export declare interface Match {
/** If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. */
confidenceScore: number;
/** Entity text as appears in the request. */
text: string;
/** Start position for the entity match text. */
offset: number;
/** Length for the entity match text. */
length: number;
}
/**
* Metadata information for an analysis poller operation.
*/
export declare interface OperationMetadata {
/**
* The date and time the operation was created.
*/
createdOn: Date;
/**
* The date and time when the operation results will expire on the server.
*/
expiresOn?: Date;
/**
* The operation id.
*/
operationId: string;
/**
* The time the operation status was last updated.
*/
lastModifiedOn: Date;
/**
* The current status of the operation.
*/
status: TextAnalyticsOperationStatus;
}
/**
* 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.
*/
export declare interface Opinion {
/**
* The target of a product/service that this assessment is about.
*/
target: TargetSentiment;
/**
* The actual assessments of the target.
*/
assessments: AssessmentSentiment[];
}
/**
* The results of an analyze actions operation represented as a paged iterator that
* iterates over the results of the requested actions.
*/
export declare interface PagedAnalyzeActionsResult extends PagedAsyncIterableAnalyzeActionsResult {
}
/**
* The results of a healthcare operation represented as a paged iterator that can
* either iterate over the results on a document-by-document basis or, by
* byPage(), can iterate over pages of documents.
*/
export declare interface PagedAnalyzeHealthcareEntitiesResult extends PagedAsyncIterableAnalyzeHealthcareEntitiesResult {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The results of an analyze Actions operation represented as a paged iterator that
* iterates over the results of the requested actions.
*/
export declare type PagedAsyncIterableAnalyzeActionsResult = PagedAsyncIterableIterator<AnalyzeActionsResult, AnalyzeActionsResult>;
/**
* The results of a healthcare operation represented as a paged iterator that can
* either iterate over the results on a document-by-document basis or, by
* byPage(), can iterate over pages of documents.
*/
export declare type PagedAsyncIterableAnalyzeHealthcareEntitiesResult = PagedAsyncIterableIterator<AnalyzeHealthcareEntitiesResult, AnalyzeHealthcareEntitiesResultArray>;
/**
* An entity from PII recognition with information about the kind of PII
* encountered.
*/
export declare interface PiiEntity extends Entity {
}
/**
* Defines values for PiiCategory. \
* {@link KnownPiiCategory} can be used interchangeably with PiiCategory,
* 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**
*/
export declare type PiiEntityCategory = string;
/**
* The types of PII domains the user can choose from.
*/
export declare enum PiiEntityDomain {
/**
* @see {@link https://aka.ms/tanerpii} for more information.
*/
PROTECTED_HEALTH_INFORMATION = "PHI"
}
/**
* Options for an entities recognition action.
*/
export declare interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
/**
* 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. Setting this parameter to true,
* disables input logging and may limit our ability to remediate issues that occur.
*/
disableServiceLogs?: boolean;
}
/**
* The error of a recognize categorized entities action.
*/
export declare type RecognizeCategorizedEntitiesActionErrorResult = TextAnalyticsActionErrorResult;
/**
* The result of a recognize categorized entities action.
*/
export declare type RecognizeCategorizedEntitiesActionResult = RecognizeCategorizedEntitiesActionSuccessResult | RecognizeCategorizedEntitiesActionErrorResult;
/**
* The results of a succeeded recognize categorized entities action.
*/
export declare interface RecognizeCategorizedEntitiesActionSuccessResult extends TextAnalyticsActionSuccessState {
/**
* Array of the results for each categorized entities recognition action.
*/
results: RecognizeCategorizedEntitiesResultArray;
}
/**
* An error result from the recognize entities operation on a single document.
*/
export declare type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;
/**
* Options for the recognize entities operation.
*/
export declare interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
}
/**
* The result of the recognize entities operation on a single document.
*/
export declare type RecognizeCategorizedEntitiesResult = RecognizeCategorizedEntitiesSuccessResult | RecognizeCategorizedEntitiesErrorResult;
/**
* Array of `RecognizeCategorizedEntitiesResult` objects corresponding to a batch of input documents, and
* annotated with information about the batch operation.
*/
export declare interface RecognizeCategorizedEntitiesResultArray extends Array<RecognizeCategorizedEntitiesResult> {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The result of the recognize entities operation on a single document, containing the collection of
* `Entity` objects identified in that document.
*/
export declare interface RecognizeCategorizedEntitiesSuccessResult extends TextAnalyticsSuccessResult {
/**
* The collection of entities identified in the input document.
*/
readonly entities: CategorizedEntity[];
}
/**
* Options for an entities linking action.
*/
export declare interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
/**
* 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. Setting this parameter to true,
* disables input logging and may limit our ability to remediate issues that occur.
*/
disableServiceLogs?: boolean;
}
/**
* The error of a recognize linked entities action.
*/
export declare type RecognizeLinkedEntitiesActionErrorResult = TextAnalyticsActionErrorResult;
/**
* The result of a recognize linked entities action.
*/
export declare type RecognizeLinkedEntitiesActionResult = RecognizeLinkedEntitiesActionSuccessResult | RecognizeLinkedEntitiesActionErrorResult;
/**
* The results of a succeeded recognize linked entities action.
*/
export declare interface RecognizeLinkedEntitiesActionSuccessResult extends TextAnalyticsActionSuccessState {
/**
* Array of the results for each linked entities recognition action.
*/
results: RecognizeLinkedEntitiesResultArray;
}
/**
* An error result from the recognize linked entities operation on a single document.
*/
export declare type RecognizeLinkedEntitiesErrorResult = TextAnalyticsErrorResult;
/**
* Options for the recognize linked entities operation.
*/
export declare interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
}
/**
* The result of the recognize linked entities operation on a single document.
*/
export declare type RecognizeLinkedEntitiesResult = RecognizeLinkedEntitiesSuccessResult | RecognizeLinkedEntitiesErrorResult;
/**
* Array of `RecognizeLinkedEntitiesResult` objects corresponding to a batch of input documents, and
* annotated with information about the batch operation.
*/
export declare interface RecognizeLinkedEntitiesResultArray extends Array<RecognizeLinkedEntitiesResult> {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The result of the recognize linked entities operation on a single document,
* containing a collection of the `LinkedEntity` objects identified in that document.
*/
export declare interface RecognizeLinkedEntitiesSuccessResult extends TextAnalyticsSuccessResult {
/**
* The collection of entities identified in the input document.
*/
readonly entities: LinkedEntity[];
}
/**
* Options for a Pii entities recognition action.
*/
export declare interface RecognizePiiEntitiesAction extends TextAnalyticsAction {
/**
* Filters entities to ones only included in the specified domain (e.g., if
* set to 'PHI', entities in the Protected Healthcare Information domain will
* only be returned). @see {@link https://aka.ms/tanerpii} for more information.
*/
domainFilter?: PiiEntityDomain;
/**
* Filters entities to ones only included in the specified array of categories
*/
categoriesFilter?: PiiEntityCategory[];
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
/**
* If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics
* will not log your input text for pii entities recognition. Setting this parameter to false,
* enables input logging.
*/
disableServiceLogs?: boolean;
}
/**
* The error of a recognize pii entities action.
*/
export declare type RecognizePiiEntitiesActionErrorResult = TextAnalyticsActionErrorResult;
/**
* The result of a recognize pii entities action.
*/
export declare type RecognizePiiEntitiesActionResult = RecognizePiiEntitiesActionSuccessResult | RecognizePiiEntitiesActionErrorResult;
/**
* The results of a succeeded recognize pii entities action.
*/
export declare interface RecognizePiiEntitiesActionSuccessResult extends TextAnalyticsActionSuccessState {
/**
* Array of the results for each pii entities recognition action.
*/
results: RecognizePiiEntitiesResultArray;
}
/**
* An error result from the recognize entities operation on a single document.
*/
export declare type RecognizePiiEntitiesErrorResult = TextAnalyticsErrorResult;
/**
* Options for the recognize PII entities operation.
*/
export declare interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {
/**
* Filters entities to ones only included in the specified domain (e.g., if
* set to 'PHI', entities in the Protected Healthcare Information domain will
* only be returned). @see {@link https://aka.ms/tanerpii} for more information.
*/
domainFilter?: PiiEntityDomain;
/**
* Specifies the measurement unit used to calculate the offset and length properties.
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
* The default is the JavaScript's default which is "Utf16CodeUnit".
*/
stringIndexType?: StringIndexType;
/**
* Filters entities to ones only included in the specified array of categories
*/
categoriesFilter?: PiiEntityCategory[];
}
/**
* The result of the recognize entities operation on a single document.
*/
export declare type RecognizePiiEntitiesResult = RecognizePiiEntitiesSuccessResult | RecognizePiiEntitiesErrorResult;
/**
* Collection of `RecognizePiiEntitiesResult` objects corresponding to a batch of input documents, and
* annotated with information about the batch operation.
*/
export declare interface RecognizePiiEntitiesResultArray extends Array<RecognizePiiEntitiesResult> {
/**
* Statistics about the input document batch and how it was processed
* by the service. This property will have a value when includeStatistics is set to true
* in the client call.
*/
statistics?: TextDocumentBatchStatistics;
/**
* The version of the text analytics model used by this operation on this
* batch of input documents.
*/
modelVersion: string;
}
/**
* The result of the recognize entities operation on a single document, containing the collection of
* `Entity` objects identified in that document.
*/
export declare interface RecognizePiiEntitiesSuccessResult extends TextAnalyticsSuccessResult {
/**
* The collection of entities identified in the input document.
*/
readonly entities: PiiEntity[];
/**
* The text redacted.
*/
redactedText: string;
}
export declare interface SentenceAssessment {
/** Assessment sentiment in the sentence. */
sentiment: TokenSentimentValue;
/** Assessment sentiment confidence scores in the sentence. */
confidenceScores: TargetConfidenceScoreLabel;
/** The assessment offset from the start of the sentence. */
offset: number;
/** The length of the assessment. */
length: number;
/** The assessment text detected. */
text: string;
/** The indicator representing if the assessment is negated. */
isNegated: boolean;
}
/**
* The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.
*/
export declare interface SentenceSentiment {
/**
* The sentence text.
*/
text: string;
/**
* The predicted Sentiment for the sentence.
*/
sentiment: SentenceSentimentLabel;
/**
* The sentiment confidence score between 0 and 1 for the sentence for all classes.
*/
confidenceScores: SentimentConfidenceScores;
/**
* The sentence text offset from the start of the document.
*/
offset: number;
/**
* The length of the sentence text.
*/
length: number;
/**
* The list of opinions mined from this sentence. For example in "The food is
* good, but the service is bad", we would mine these two opinions "food is
* good", "service is bad". Only returned if `includeOpinionMining` is set to
* True in the call to `analyzeSentiment`.
*/
opinions: Opinion[];
}
/** Defines values for SentenceSentimentLabel. */
export declare type SentenceSentimentLabel = "positive" | "neutral" | "negative";
/** Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative. */
export declare interface SentimentConfidenceScores {
positive: number;
neutral: number;
negative: number;
}
/**
* Measurement units that can used to calculate the offset and length properties.
*/
export declare type StringIndexType = "TextElement_v8" | "UnicodeCodePoint" | "Utf16CodeUnit";
/** Represents the confidence scores across all sentiment classes: positive, neutral, negative. */
export declare interface TargetConfidenceScoreLabel {
positive: number;
negative: number;
}
/**
* TargetSentiment contains the predicted sentiment, confidence scores and other
* information about an 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".
*/
export declare interface