@azure/ai-text-analytics
Advanced tools
Comparing version 1.0.0-dev.20200225.1 to 1.0.0-dev.20200305.1
# Release History | ||
## 1.0.0-preview.3 (Unreleased) | ||
- [Breaking] Renamed `id` to `dataSourceEntityId` in the `LinkedEntity` type. | ||
- Added special handling for the string `"none"` as the `countryHint` parameter of the `TextAnalyticsClient.detectLanguage`. `"none"` is now treated the same as the empty string, and indicates that the default language detection model should be used. | ||
- [Breaking] Renamed `offset` to `graphemeOffset` and `length` to `graphemeLength` in fields of response objects as appropriate in order to make it clear that the offsets and lengths are in units of Unicode graphemes. | ||
- [Breaking] Renamed `sentimentScores` on both `DocumentSentiment` and `SentenceSentiment` to `confidenceScores`, and renamed the type `SentimentScorePerLabel` back to `SentimentConfidenceScorePerLabel`. | ||
## 1.0.0-preview.2 (2020-02-11) | ||
- Added support for rotating API keys via the `TextAnalyticsApiKeyCredential.updateKey` method. #6972 | ||
- Added a discriminant type for `TextAnalyticsResult.error` to allow for easy differentiation between success and error types using `if (result.error) { ... }` in both TypeScript and JavaScript. #7046 | ||
- [Breaking] Removed the `Entity` type and added new return types `CategorizedEntity` and `PiiEntity` for the `recognizeEntities` and `recognizePiiEntities` methods respectively. These types are equivalent to the previous `Entity` type. #7220 | ||
- [Breaking] Removed the `detectedLanguages` property from `DetectLanguageResult`, as the service currently only returns one language. #7220 | ||
- [Breaking] Renamed the `detectLanguages` method to `detectLanguage`, as the `detectedLanguages` property was removed from the `DetectLanguageResult` return type. #7220 | ||
- [Breaking] Renamed `documentScores` and `sentenceScores` on the `DocumentSentiment` and `SentenceSentiment` types both to `sentimentScores`. #7220 | ||
- [Breaking] Renamed `type` and `subtype` to `category` and `subcategory` respectively in the `CategorizedEntity` and `PiiEntity` types. #7220 | ||
- [Breaking] Renamed `DocumentSentimentValue` and `SentenceSentimentValue` to `DocumentSentimentLabel` and `SentenceSentimentLabel` respectively. #7220 | ||
- [Breaking] Renamed `SentimentConfidenceScorePerLabel` to `SentimentScorePerLabel`. #7220 | ||
- [Breaking] Refactored `TextAnalyticsError` to flatten the error hierarchy and remove `innerError`. The new error model has properties for `code`, `message`, and an optional `target` only. The `code` property of `TextAnalyticsError` can now contain all of the codes from the previous `InnerErrorCodeValue` as well as those from the top-level `ErrorCodeValue`. #7276 | ||
- Added support for rotating API keys via the `TextAnalyticsApiKeyCredential.updateKey` method. | ||
- Added a discriminant type for `TextAnalyticsResult.error` to allow for easy differentiation between success and error types using `if (result.error) { ... }` in both TypeScript and JavaScript. | ||
- [Breaking] Removed the `Entity` type and added new return types `CategorizedEntity` and `PiiEntity` for the `recognizeEntities` and `recognizePiiEntities` methods respectively. These types are equivalent to the previous `Entity` type. | ||
- [Breaking] Removed the `detectedLanguages` property from `DetectLanguageResult`, as the service currently only returns one language. | ||
- [Breaking] Renamed the `detectLanguages` method to `detectLanguage`, as the `detectedLanguages` property was removed from the `DetectLanguageResult` return type. | ||
- [Breaking] Renamed `documentScores` and `sentenceScores` on the `DocumentSentiment` and `SentenceSentiment` types both to `sentimentScores`. | ||
- [Breaking] Renamed `type` and `subtype` to `category` and `subcategory` respectively in the `CategorizedEntity` and `PiiEntity` types. | ||
- [Breaking] Renamed `DocumentSentimentValue` and `SentenceSentimentValue` to `DocumentSentimentLabel` and `SentenceSentimentLabel` respectively. | ||
- [Breaking] Renamed `SentimentConfidenceScorePerLabel` to `SentimentScorePerLabel`. | ||
- [Breaking] Refactored `TextAnalyticsError` to flatten the error hierarchy and remove `innerError`. The new error model has properties for `code`, `message`, and an optional `target` only. The `code` property of `TextAnalyticsError` can now contain all of the codes from the previous `InnerErrorCodeValue` as well as those from the top-level `ErrorCodeValue`. | ||
@@ -19,0 +22,0 @@ ## 1.0.0-preview.1 (2020-01-09) |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult"; | ||
export function makeAnalyzeSentimentResult(id, sentiment, sentimentScores, sentences, statistics) { | ||
export function makeAnalyzeSentimentResult(id, sentiment, confidenceScores, sentences, statistics) { | ||
return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, statistics)), { sentiment, | ||
sentimentScores, | ||
confidenceScores, | ||
sentences }); | ||
@@ -8,0 +8,0 @@ } |
@@ -218,7 +218,7 @@ /* | ||
}; | ||
export const SentimentScorePerLabel = { | ||
serializedName: "SentimentScorePerLabel", | ||
export const SentimentConfidenceScorePerLabel = { | ||
serializedName: "SentimentConfidenceScorePerLabel", | ||
type: { | ||
name: "Composite", | ||
className: "SentimentScorePerLabel", | ||
className: "SentimentConfidenceScorePerLabel", | ||
modelProperties: { | ||
@@ -267,3 +267,3 @@ positive: { | ||
}, | ||
sentimentScores: { | ||
confidenceScores: { | ||
required: true, | ||
@@ -273,6 +273,6 @@ serializedName: "sentenceScores", | ||
name: "Composite", | ||
className: "SentimentScorePerLabel" | ||
className: "SentimentConfidenceScorePerLabel" | ||
} | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -284,3 +284,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -344,3 +344,3 @@ serializedName: "length", | ||
name: "Composite", | ||
className: "SentimentScorePerLabel" | ||
className: "SentimentConfidenceScorePerLabel" | ||
} | ||
@@ -476,3 +476,3 @@ }, | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -484,3 +484,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -607,3 +607,3 @@ serializedName: "length", | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -615,3 +615,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -659,3 +659,3 @@ serializedName: "length", | ||
}, | ||
id: { | ||
dataSourceEntityId: { | ||
serializedName: "id", | ||
@@ -662,0 +662,0 @@ type: { |
@@ -74,3 +74,4 @@ // Copyright (c) Microsoft Corporation. | ||
else { | ||
realInputs = inputs; | ||
// Replace "none" hints with "" | ||
realInputs = inputs.map((input) => (Object.assign(Object.assign({}, input), { countryHint: input.countryHint === "none" ? "" : input.countryHint }))); | ||
realOptions = countryHintOrOptions || {}; | ||
@@ -262,2 +263,5 @@ } | ||
function convertToDetectLanguageInput(inputs, countryHint) { | ||
if (countryHint === "none") { | ||
countryHint = ""; | ||
} | ||
return inputs.map((text, index) => { | ||
@@ -264,0 +268,0 @@ return { |
@@ -232,7 +232,7 @@ 'use strict'; | ||
}; | ||
const SentimentScorePerLabel = { | ||
serializedName: "SentimentScorePerLabel", | ||
const SentimentConfidenceScorePerLabel = { | ||
serializedName: "SentimentConfidenceScorePerLabel", | ||
type: { | ||
name: "Composite", | ||
className: "SentimentScorePerLabel", | ||
className: "SentimentConfidenceScorePerLabel", | ||
modelProperties: { | ||
@@ -281,3 +281,3 @@ positive: { | ||
}, | ||
sentimentScores: { | ||
confidenceScores: { | ||
required: true, | ||
@@ -287,6 +287,6 @@ serializedName: "sentenceScores", | ||
name: "Composite", | ||
className: "SentimentScorePerLabel" | ||
className: "SentimentConfidenceScorePerLabel" | ||
} | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -298,3 +298,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -358,3 +358,3 @@ serializedName: "length", | ||
name: "Composite", | ||
className: "SentimentScorePerLabel" | ||
className: "SentimentConfidenceScorePerLabel" | ||
} | ||
@@ -490,3 +490,3 @@ }, | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -498,3 +498,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -621,3 +621,3 @@ serializedName: "length", | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -629,3 +629,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -673,3 +673,3 @@ serializedName: "length", | ||
}, | ||
id: { | ||
dataSourceEntityId: { | ||
serializedName: "id", | ||
@@ -1041,3 +1041,3 @@ type: { | ||
TextDocumentStatistics: TextDocumentStatistics, | ||
SentimentScorePerLabel: SentimentScorePerLabel, | ||
SentimentConfidenceScorePerLabel: SentimentConfidenceScorePerLabel, | ||
SentenceSentiment: SentenceSentiment, | ||
@@ -1490,5 +1490,5 @@ DocumentSentiment: DocumentSentiment, | ||
// Copyright (c) Microsoft Corporation. | ||
function makeAnalyzeSentimentResult(id, sentiment, sentimentScores, sentences, statistics) { | ||
function makeAnalyzeSentimentResult(id, sentiment, confidenceScores, sentences, statistics) { | ||
return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, statistics)), { sentiment, | ||
sentimentScores, | ||
confidenceScores, | ||
sentences }); | ||
@@ -1648,3 +1648,4 @@ } | ||
else { | ||
realInputs = inputs; | ||
// Replace "none" hints with "" | ||
realInputs = inputs.map((input) => (Object.assign(Object.assign({}, input), { countryHint: input.countryHint === "none" ? "" : input.countryHint }))); | ||
realOptions = countryHintOrOptions || {}; | ||
@@ -1836,2 +1837,5 @@ } | ||
function convertToDetectLanguageInput(inputs, countryHint) { | ||
if (countryHint === "none") { | ||
countryHint = ""; | ||
} | ||
return inputs.map((text, index) => { | ||
@@ -1838,0 +1842,0 @@ return { |
@@ -6,3 +6,3 @@ { | ||
"description": "An isomorphic client library for the Azure Text Analytics service.", | ||
"version": "1.0.0-dev.20200225.1", | ||
"version": "1.0.0-dev.20200305.1", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "node", |
@@ -15,3 +15,3 @@ // Copyright (c) Microsoft Corporation. | ||
SentenceSentiment, | ||
SentimentScorePerLabel | ||
SentimentConfidenceScorePerLabel | ||
} from "./generated/models"; | ||
@@ -37,3 +37,3 @@ | ||
*/ | ||
sentimentScores: SentimentScorePerLabel; | ||
confidenceScores: SentimentConfidenceScorePerLabel; | ||
/** | ||
@@ -53,3 +53,3 @@ * The predicted sentiment for each sentence in the corresponding document. | ||
sentiment: DocumentSentimentLabel, | ||
sentimentScores: SentimentScorePerLabel, | ||
confidenceScores: SentimentConfidenceScorePerLabel, | ||
sentences: SentenceSentiment[], | ||
@@ -61,3 +61,3 @@ statistics?: TextDocumentStatistics | ||
sentiment, | ||
sentimentScores, | ||
confidenceScores, | ||
sentences | ||
@@ -64,0 +64,0 @@ }; |
@@ -129,3 +129,3 @@ /* | ||
*/ | ||
export interface SentimentScorePerLabel { | ||
export interface SentimentConfidenceScorePerLabel { | ||
positive: number; | ||
@@ -148,11 +148,11 @@ neutral: number; | ||
*/ | ||
sentimentScores: SentimentScorePerLabel; | ||
confidenceScores: SentimentConfidenceScorePerLabel; | ||
/** | ||
* The sentence offset from the start of the document. | ||
*/ | ||
offset: number; | ||
graphemeOffset: number; | ||
/** | ||
* The length of the sentence by Unicode standard. | ||
*/ | ||
length: number; | ||
graphemeLength: number; | ||
/** | ||
@@ -181,3 +181,3 @@ * The warnings generated for the sentence. | ||
*/ | ||
documentScores: SentimentScorePerLabel; | ||
documentScores: SentimentConfidenceScorePerLabel; | ||
/** | ||
@@ -250,9 +250,9 @@ * Sentence level sentiment analysis. | ||
/** | ||
* Start position (in Unicode characters) for the entity text. | ||
* Start position (in Unicode graphemes) for the entity text. | ||
*/ | ||
offset: number; | ||
graphemeOffset: number; | ||
/** | ||
* Length (in Unicode characters) for the entity text. | ||
* Length (in Unicode graphemes) for the entity text. | ||
*/ | ||
length: number; | ||
graphemeLength: number; | ||
/** | ||
@@ -316,9 +316,9 @@ * Confidence score between 0 and 1 of the extracted entity. | ||
/** | ||
* Start position (in Unicode characters) for the entity match text. | ||
* Start position (in Unicode graphemes) for the entity match text. | ||
*/ | ||
offset: number; | ||
graphemeOffset: number; | ||
/** | ||
* Length (in Unicode characters) for the entity match text. | ||
* Length (in Unicode graphemes) for the entity match text. | ||
*/ | ||
length: number; | ||
graphemeLength: number; | ||
} | ||
@@ -345,3 +345,3 @@ | ||
*/ | ||
id?: string; | ||
dataSourceEntityId?: string; | ||
/** | ||
@@ -348,0 +348,0 @@ * URL for the entity's page from the data source. |
@@ -228,7 +228,7 @@ /* | ||
export const SentimentScorePerLabel: coreHttp.CompositeMapper = { | ||
serializedName: "SentimentScorePerLabel", | ||
export const SentimentConfidenceScorePerLabel: coreHttp.CompositeMapper = { | ||
serializedName: "SentimentConfidenceScorePerLabel", | ||
type: { | ||
name: "Composite", | ||
className: "SentimentScorePerLabel", | ||
className: "SentimentConfidenceScorePerLabel", | ||
modelProperties: { | ||
@@ -278,3 +278,3 @@ positive: { | ||
}, | ||
sentimentScores: { | ||
confidenceScores: { | ||
required: true, | ||
@@ -284,6 +284,6 @@ serializedName: "sentenceScores", | ||
name: "Composite", | ||
className: "SentimentScorePerLabel" | ||
className: "SentimentConfidenceScorePerLabel" | ||
} | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -295,3 +295,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -356,3 +356,3 @@ serializedName: "length", | ||
name: "Composite", | ||
className: "SentimentScorePerLabel" | ||
className: "SentimentConfidenceScorePerLabel" | ||
} | ||
@@ -491,3 +491,3 @@ }, | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -499,3 +499,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -625,3 +625,3 @@ serializedName: "length", | ||
}, | ||
offset: { | ||
graphemeOffset: { | ||
required: true, | ||
@@ -633,3 +633,3 @@ serializedName: "offset", | ||
}, | ||
length: { | ||
graphemeLength: { | ||
required: true, | ||
@@ -678,3 +678,3 @@ serializedName: "length", | ||
}, | ||
id: { | ||
dataSourceEntityId: { | ||
serializedName: "id", | ||
@@ -681,0 +681,0 @@ type: { |
@@ -27,7 +27,3 @@ /* | ||
*/ | ||
constructor( | ||
credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, | ||
endpoint: string, | ||
options?: coreHttp.ServiceClientOptions | ||
) { | ||
constructor(credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, endpoint: string, options?: coreHttp.ServiceClientOptions) { | ||
if (endpoint == undefined) { | ||
@@ -34,0 +30,0 @@ throw new Error("'endpoint' cannot be null."); |
@@ -66,3 +66,3 @@ // Copyright (c) Microsoft Corporation. | ||
TextDocumentStatistics, | ||
SentimentScorePerLabel, | ||
SentimentConfidenceScorePerLabel, | ||
MultiLanguageInput as TextDocumentInput, | ||
@@ -69,0 +69,0 @@ LanguageInput as DetectLanguageInput, |
@@ -205,4 +205,4 @@ // Copyright (c) Microsoft Corporation. | ||
* set to the default country hint in `TextAnalyticsClientOptions`. | ||
* If set to an empty string, the service will apply a model where the | ||
* country is explicitly set to "None". | ||
* If set to an empty string, or the string "none", the service will apply a | ||
* model where the country is explicitly unset. | ||
* The same country hint is applied to all strings in the input collection. | ||
@@ -242,3 +242,7 @@ * @param options Optional parameters for the operation. | ||
} else { | ||
realInputs = inputs; | ||
// Replace "none" hints with "" | ||
realInputs = inputs.map((input) => ({ | ||
...input, | ||
countryHint: input.countryHint === "none" ? "" : input.countryHint | ||
})); | ||
realOptions = (countryHintOrOptions as DetectLanguageOptions) || {}; | ||
@@ -691,2 +695,5 @@ } | ||
): DetectLanguageInput[] { | ||
if (countryHint === "none") { | ||
countryHint = ""; | ||
} | ||
return inputs.map( | ||
@@ -693,0 +700,0 @@ (text: string, index): DetectLanguageInput => { |
@@ -53,3 +53,3 @@ import { OperationOptions } from '@azure/core-http'; | ||
*/ | ||
sentimentScores: SentimentScorePerLabel; | ||
confidenceScores: SentimentConfidenceScorePerLabel; | ||
/** | ||
@@ -169,9 +169,9 @@ * The predicted sentiment for each sentence in the corresponding document. | ||
/** | ||
* Start position (in Unicode characters) for the entity text. | ||
* Start position (in Unicode graphemes) for the entity text. | ||
*/ | ||
offset: number; | ||
graphemeOffset: number; | ||
/** | ||
* Length (in Unicode characters) for the entity text. | ||
* Length (in Unicode graphemes) for the entity text. | ||
*/ | ||
length: number; | ||
graphemeLength: number; | ||
/** | ||
@@ -274,3 +274,3 @@ * Confidence score between 0 and 1 of the extracted entity. | ||
*/ | ||
id?: string; | ||
dataSourceEntityId?: string; | ||
/** | ||
@@ -300,9 +300,9 @@ * URL for the entity's page from the data source. | ||
/** | ||
* Start position (in Unicode characters) for the entity match text. | ||
* Start position (in Unicode graphemes) for the entity match text. | ||
*/ | ||
offset: number; | ||
graphemeOffset: number; | ||
/** | ||
* Length (in Unicode characters) for the entity match text. | ||
* Length (in Unicode graphemes) for the entity match text. | ||
*/ | ||
length: number; | ||
graphemeLength: number; | ||
} | ||
@@ -461,11 +461,11 @@ | ||
*/ | ||
sentimentScores: SentimentScorePerLabel; | ||
confidenceScores: SentimentConfidenceScorePerLabel; | ||
/** | ||
* The sentence offset from the start of the document. | ||
*/ | ||
offset: number; | ||
graphemeOffset: number; | ||
/** | ||
* The length of the sentence by Unicode standard. | ||
*/ | ||
length: number; | ||
graphemeLength: number; | ||
/** | ||
@@ -489,3 +489,3 @@ * The warnings generated for the sentence. | ||
*/ | ||
export declare interface SentimentScorePerLabel { | ||
export declare interface SentimentConfidenceScorePerLabel { | ||
positive: number; | ||
@@ -570,4 +570,4 @@ neutral: number; | ||
* set to the default country hint in `TextAnalyticsClientOptions`. | ||
* If set to an empty string, the service will apply a model where the | ||
* country is explicitly set to "None". | ||
* If set to an empty string, or the string "none", the service will apply a | ||
* model where the country is explicitly unset. | ||
* The same country hint is applied to all strings in the input collection. | ||
@@ -574,0 +574,0 @@ * @param options Optional parameters for the operation. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
465412
8388