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

[Language Text] Remove defaultLanguage #25090

Merged
merged 4 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions sdk/cognitivelanguage/ai-language-text/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Add support for logging API warnings that are part of warn-text response headers.
- Add support for `partiallySucceeded` status and parse action error pointers.

### Breaking Changes

- Remove `defaultLanguage` from the `BeginAnalyzeBatchOptions` interface.

## 1.1.0-beta.1 (2022-11-17)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export interface BatchActionSuccessResult<T, Kind extends AnalyzeBatchActionName

// @public
export interface BeginAnalyzeBatchOptions extends TextAnalysisOperationOptions {
defaultLanguage?: string;
displayName?: string;
updateIntervalInMs?: number;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions sdk/cognitivelanguage/ai-language-text/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ export interface BeginAnalyzeBatchOptions extends TextAnalysisOperationOptions {
* The operation's display name.
*/
displayName?: string;
/**
* Default language code to use for records requesting automatic language detection
*/
defaultLanguage?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ export class TextAnalysisClient {
*
* ```js
* const documents = [<input strings>];
* const languageHint = "en";
* const languageCode = "en";
* const categoriesFilter = [KnownPiiCategory.USSocialSecurityNumber];
* const domainFilter = KnownPiiDomain.Phi;
* const results = await client.analyze("PiiEntityRecognition", documents, languageHint, {
* const results = await client.analyze("PiiEntityRecognition", documents, languageCode, {
* domainFilter, categoriesFilter
* });
*
Expand Down Expand Up @@ -444,8 +444,7 @@ export class TextAnalysisClient {
* about the languages supported for Entity Recognition actions can be
* found in {@link https://docs.microsoft.com//azure/cognitive-services/language-service/named-entity-recognition/language-support}.
* If set to "auto", the service will automatically infer the language from
* the input text. If that process fails, the value in the `defaultLanguage`
* option will be used.
* the input text.
* @param options - optional action parameters and settings for the operation
*
* @returns an array of results corresponding to the input documents
Expand Down Expand Up @@ -578,8 +577,7 @@ export class TextAnalysisClient {
* about the languages supported for Entity Recognition actions can be
* found in {@link https://docs.microsoft.com//azure/cognitive-services/language-service/named-entity-recognition/language-support}.
* If set to "auto", the service will automatically infer the language from
* the input text. If that process fails, the value in the `defaultLanguage`
* option will be used.
* the input text.
* @param options - optional settings for the operation
*
* @returns an array of results corresponding to the input actions
Expand Down Expand Up @@ -660,8 +658,8 @@ export class TextAnalysisClient {
}

if (isStringArray(documents)) {
const languageHint = (languageOrOptions as string) ?? this.defaultLanguage;
realInputs = convertToTextDocumentInput(documents, languageHint);
const languageCode = (languageOrOptions as string) ?? this.defaultLanguage;
realInputs = convertToTextDocumentInput(documents, languageCode);
realOptions = options;
} else {
realInputs = documents;
Expand Down
5 changes: 5 additions & 0 deletions sdk/cognitivelanguage/ai-language-text/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ directive:
transform: >
$["x-ms-enum"].name = "WarningCode";

- from: swagger-document
where: $.definitions.AnalyzeTextJobsInput.properties
transform: >
delete $["defaultLanguage"];

- from: swagger-document
where: $.definitions.DocumentWarning.properties
transform: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,6 @@ matrix([["APIKey", "AAD"]] as const, async (authMethod: AuthMethod) => {
"auto",
{
updateIntervalInMs: pollingInterval,
defaultLanguage: "en",
}
);
await assertActionsResults(await poller.pollUntilDone(), expectation71);
Expand Down