Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Text Analytics] Removes the length property from output types #11532

Merged
merged 4 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export interface AspectConfidenceScoreLabel {
// @public
export interface AspectSentiment {
confidenceScores: AspectConfidenceScoreLabel;
length: number;
offset: number;
sentiment: TokenSentimentValue;
text: string;
Expand Down Expand Up @@ -100,7 +99,6 @@ export type DocumentSentimentLabel = "positive" | "neutral" | "negative" | "mixe
export interface Entity {
category: string;
confidenceScore: number;
length: number;
offset: number;
subCategory?: string;
text: string;
Expand Down Expand Up @@ -149,7 +147,6 @@ export interface LinkedEntity {
// @public
export interface Match {
confidenceScore: number;
length: number;
offset: number;
text: string;
}
Expand Down Expand Up @@ -240,7 +237,6 @@ export interface RecognizePiiEntitiesSuccessResult extends TextAnalyticsSuccessR
export interface SentenceOpinion {
confidenceScores: AspectConfidenceScoreLabel;
isNegated: boolean;
length: number;
offset: number;
sentiment: TokenSentimentValue;
text: string;
Expand All @@ -249,7 +245,6 @@ export interface SentenceOpinion {
// @public
export interface SentenceSentiment {
confidenceScores: SentimentConfidenceScores;
length: number;
minedOpinions: MinedOpinion[];
offset: number;
sentiment: SentenceSentimentLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export interface SentenceSentiment {
* 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 mind these two opinions "food is
Expand Down Expand Up @@ -106,10 +102,6 @@ export interface AspectSentiment {
* The aspect text offset from the start of the sentence.
*/
offset: number;
/**
* The length of the aspect text.
*/
length: number;
}

/**
Expand Down Expand Up @@ -182,7 +174,6 @@ function convertGeneratedSentenceSentiment(
confidenceScores: sentence.confidenceScores,
sentiment: sentence.sentiment,
text: sentence.text,
length: sentence.length,
offset: sentence.offset,
minedOpinions: sentence.aspects
? sentence.aspects.map(
Expand All @@ -191,8 +182,7 @@ function convertGeneratedSentenceSentiment(
confidenceScores: aspect.confidenceScores,
sentiment: aspect.sentiment,
text: aspect.text,
offset: aspect.offset,
length: aspect.length
offset: aspect.offset
},
opinions: aspect.relations
.filter((relation) => relation.relationType === "opinion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http";
import { GeneratedClientOptionalParams } from "./models";

const packageName = "@azure/ai-text-analytics";
const packageVersion = "5.1.0-beta.2";
const packageVersion = "5.1.0-beta.1";
deyaaeldeen marked this conversation as resolved.
Show resolved Hide resolved

export class GeneratedClientContext extends coreHttp.ServiceClient {
endpoint: string;
Expand Down
20 changes: 0 additions & 20 deletions sdk/textanalytics/ai-text-analytics/src/generated/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ export interface Entity {
* Start position for the entity text.
*/
offset: number;
/**
* Length for the entity text.
*/
length: number;
/**
* Confidence score between 0 and 1 of the extracted entity.
*/
Expand Down Expand Up @@ -348,10 +344,6 @@ export interface Match {
* Start position for the entity match text.
*/
offset: number;
/**
* Length for the entity match text.
*/
length: number;
}

export interface KeyPhraseResult {
Expand Down Expand Up @@ -539,10 +531,6 @@ export interface SentenceSentiment {
* The sentence offset from the start of the document.
*/
offset: number;
/**
* The length of the sentence.
*/
length: number;
/**
* The array of aspect object for the sentence.
*/
Expand All @@ -566,10 +554,6 @@ export interface SentenceAspect {
* The aspect offset from the start of the sentence.
*/
offset: number;
/**
* The length of the aspect.
*/
length: number;
/**
* The aspect text detected.
*/
Expand Down Expand Up @@ -612,10 +596,6 @@ export interface SentenceOpinion {
* The opinion offset from the start of the sentence.
*/
offset: number;
/**
* The length of the opinion.
*/
length: number;
/**
* The aspect text detected.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ export const Entity: coreHttp.CompositeMapper = {
name: "Number"
}
},
length: {
serializedName: "length",
required: true,
type: {
name: "Number"
}
},
confidenceScore: {
serializedName: "confidenceScore",
required: true,
Expand Down Expand Up @@ -651,13 +644,6 @@ export const Match: coreHttp.CompositeMapper = {
type: {
name: "Number"
}
},
length: {
serializedName: "length",
required: true,
type: {
name: "Number"
}
}
}
}
Expand Down Expand Up @@ -1067,13 +1053,6 @@ export const SentenceSentiment: coreHttp.CompositeMapper = {
name: "Number"
}
},
length: {
serializedName: "length",
required: true,
type: {
name: "Number"
}
},
aspects: {
serializedName: "aspects",
type: {
Expand Down Expand Up @@ -1119,13 +1098,6 @@ export const SentenceAspect: coreHttp.CompositeMapper = {
name: "Number"
}
},
length: {
serializedName: "length",
required: true,
type: {
name: "Number"
}
},
text: {
serializedName: "text",
required: true,
Expand Down Expand Up @@ -1219,13 +1191,6 @@ export const SentenceOpinion: coreHttp.CompositeMapper = {
name: "Number"
}
},
length: {
serializedName: "length",
required: true,
type: {
name: "Number"
}
},
text: {
serializedName: "text",
required: true,
Expand Down
20 changes: 16 additions & 4 deletions sdk/textanalytics/ai-text-analytics/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ directive:
- from: swagger-document
where: $.definitions.DocumentStatistics
transform: >
$["x-ms-client-name"] = "TextDocumentStatistics";
$["x-ms-client-name"] = "TextDocumentStatistics";
```

### RequestStatistics => TextDocumentBatchStatistics
Expand All @@ -102,7 +102,7 @@ directive:
- from: swagger-document
where: $.definitions.RequestStatistics
transform: >
$["x-ms-client-name"] = "TextDocumentBatchStatistics";
$["x-ms-client-name"] = "TextDocumentBatchStatistics";
```

### Rename showStats -> includeStatistics
Expand All @@ -121,7 +121,7 @@ directive:
}
```

### Rename {Document,Sentence}SentimentValue -> Label
### Rename {Document,Sentence}SentimentValue -> Label

```yaml
directive:
Expand Down Expand Up @@ -155,14 +155,26 @@ directive:
$["x-ms-client-name"] = "dataSourceEntityId";
```

### Remove Entity/Match offset/length

```yaml
directive:
- from: swagger-document
where: $.definitions..properties
transform: >
if ($.length !== undefined) {
$.length = undefined;
}
```

### Rename SentimentConfidenceScorePerLabel -> SentimentConfidenceScores

```yaml
directive:
- from: swagger-document
where: $.definitions.SentimentConfidenceScorePerLabel
transform: >
$["x-ms-client-name"] = "SentimentConfidenceScores";
$["x-ms-client-name"] = "SentimentConfidenceScores";
```

### Change some casing to use camelCase
Expand Down
6 changes: 0 additions & 6 deletions sdk/textanalytics/ai-text-analytics/test/collections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ describe("RecognizeCategorizedEntitiesResultArray", () => {
text: "Microsoft",
category: "Organization",
confidenceScore: 0.9989,
length: 0,
offset: 0
}
],
Expand All @@ -215,7 +214,6 @@ describe("RecognizeCategorizedEntitiesResultArray", () => {
category: "DateTime",
subCategory: "DateRange",
confidenceScore: 0.8,
length: 0,
offset: 0
}
],
Expand Down Expand Up @@ -268,7 +266,6 @@ describe("RecognizeLinkedEntitiesResultArray", () => {
{
text: "Seattle",
confidenceScore: 0.15046201222847677,
length: 0,
offset: 0
}
],
Expand All @@ -289,7 +286,6 @@ describe("RecognizeLinkedEntitiesResultArray", () => {
{
text: "Microsoft",
confidenceScore: 0.1869365971673207,
length: 0,
offset: 0
}
],
Expand Down Expand Up @@ -343,7 +339,6 @@ describe("RecognizeLinkedEntitiesResultArray", () => {
text: "(555) 555-5555",
category: "US Phone Number",
confidenceScore: 0.9989,
length: 0,
offset: 0
}
],
Expand All @@ -358,7 +353,6 @@ describe("RecognizeLinkedEntitiesResultArray", () => {
category: "US Address",
subCategory: "",
confidenceScore: 0.8,
length: 0,
offset: 0
}
],
Expand Down
Loading