Skip to content

Commit

Permalink
adding analyze API
Browse files Browse the repository at this point in the history
  • Loading branch information
deyaaeldeen committed Oct 8, 2020
1 parent d1c4b37 commit d93c161
Show file tree
Hide file tree
Showing 5 changed files with 417 additions and 6 deletions.
217 changes: 217 additions & 0 deletions sdk/textanalytics/ai-text-analytics/review/ai-text-analytics.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
```ts

import { AzureKeyCredential } from '@azure/core-auth';
import * as coreHttp from '@azure/core-http';
import { HttpMethods } from '@azure/core-http';
import { KeyCredential } from '@azure/core-auth';
import { OperationArguments } from '@azure/core-http';
import { OperationOptions } from '@azure/core-http';
import { OperationSpec } from '@azure/core-http';
import { PipelineOptions } from '@azure/core-http';
import { Poller } from '@azure/core-lro';
import { PollOperationState } from '@azure/core-lro';
import { RestResponse } from '@azure/core-http';
import { TokenCredential } from '@azure/core-auth';

// @public
export type AnalyzeOptions = TextAnalyticsOperationOptions;

// @public
export type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult;

Expand Down Expand Up @@ -52,10 +62,42 @@ export interface AspectSentiment {

export { AzureKeyCredential }

// @public (undocumented)
export interface BaseResult extends RestResponse {
// (undocumented)
_lroData?: LROResponseInfo;
}

// @public
export interface CategorizedEntity extends Entity {
}

// @public (undocumented)
export type CustomClassificationTask = TextAnalyticsTask & {
parameters: CustomClassificationTaskParameters;
};

// @public (undocumented)
export interface CustomClassificationTaskParameters {
// (undocumented)
appId: string;
// (undocumented)
slotName: string;
}

// @public (undocumented)
export type CustomEntitiesTask = TextAnalyticsTask & {
parameters: CustomEntitiesTaskParameters;
};

// @public (undocumented)
export interface CustomEntitiesTaskParameters {
// (undocumented)
appId: string;
// (undocumented)
slotName: string;
}

// @public
export interface DetectedLanguage {
confidenceScore: number;
Expand Down Expand Up @@ -95,6 +137,17 @@ export interface DetectLanguageSuccessResult extends TextAnalyticsSuccessResult
// @public
export type DocumentSentimentLabel = "positive" | "neutral" | "negative" | "mixed";

// @public (undocumented)
export type EntitiesTask = TextAnalyticsTask & {
parameters?: EntitiesTaskParameters;
};

// @public (undocumented)
export interface EntitiesTaskParameters {
// (undocumented)
modelVersion?: string;
}

// @public
export interface Entity {
category: string;
Expand All @@ -104,6 +157,17 @@ export interface Entity {
text: string;
}

// @public (undocumented)
export type EntityLinkingTask = TextAnalyticsTask & {
parameters?: EntityLinkingTaskParameters;
};

// @public (undocumented)
export interface EntityLinkingTaskParameters {
// (undocumented)
modelVersion?: string;
}

// @public
export type ErrorCode = ErrorCodeValue | InnerErrorCodeValue;

Expand All @@ -130,9 +194,54 @@ export interface ExtractKeyPhrasesSuccessResult extends TextAnalyticsSuccessResu
keyPhrases: string[];
}

// @public (undocumented)
export type FinalStateVia = "azure-async-operation" | "location" | "original-uri";

// @public
export interface GeneratedClientAnalyzeHeaders {
// (undocumented)
operationLocation?: string;
}

// @public
export type GeneratedClientAnalyzeResponse = GeneratedClientAnalyzeHeaders & {
_response: coreHttp.HttpResponse & {
parsedHeaders: GeneratedClientAnalyzeHeaders;
};
};

// @public
export type InnerErrorCodeValue = "InvalidParameterValue" | "InvalidRequestBodyFormat" | "EmptyRequest" | "MissingInputRecords" | "InvalidDocument" | "ModelVersionIncorrect" | "InvalidDocumentBatch" | "UnsupportedLanguageCode" | "InvalidCountryHint";

// @public (undocumented)
export interface JobManifestTasks {
// (undocumented)
customClassificationTasks?: CustomClassificationTask[];
// (undocumented)
customEntityRecognitionTasks?: CustomEntitiesTask[];
// (undocumented)
entityLinkingTasks?: EntityLinkingTask[];
// (undocumented)
entityRecognitionPiiTasks?: PiiTask[];
// (undocumented)
entityRecognitionTasks?: EntitiesTask[];
// (undocumented)
keyPhraseExtractionTasks?: KeyPhrasesTask[];
// (undocumented)
sentimentAnalysisTasks?: SentimentTask[];
}

// @public (undocumented)
export type KeyPhrasesTask = TextAnalyticsTask & {
parameters?: KeyPhrasesTaskParameters;
};

// @public (undocumented)
export interface KeyPhrasesTaskParameters {
// (undocumented)
modelVersion?: string;
}

// @public
export interface LinkedEntity {
bingEntitySearchApiId?: string;
Expand All @@ -144,6 +253,74 @@ export interface LinkedEntity {
url: string;
}

// @public (undocumented)
export interface LROOperationState<TResult extends BaseResult> extends PollOperationState<TResult> {
// (undocumented)
finalStateVia?: FinalStateVia;
// (undocumented)
initialOperation: LROOperationStep<TResult>;
// (undocumented)
lastOperation: LROOperationStep<TResult>;
// (undocumented)
pollingStrategy: LROStrategy<TResult>;
}

// @public (undocumented)
export interface LROOperationStep<TResult extends BaseResult> {
// (undocumented)
args: OperationArguments;
// (undocumented)
result: TResult;
// (undocumented)
spec: OperationSpec;
}

// @public (undocumented)
export class LROPoller<TResult extends BaseResult> extends Poller<LROOperationState<TResult>, TResult> {
constructor({ initialOperationArguments, initialOperationResult, initialOperationSpec, sendOperation, finalStateVia, intervalInMs }: LROPollerOptions<TResult>);
delay(): Promise<void>;
}

// @public (undocumented)
export interface LROPollerOptions<TResult extends BaseResult> {
finalStateVia?: FinalStateVia;
initialOperationArguments: OperationArguments;
initialOperationResult: TResult;
initialOperationSpec: OperationSpec;
intervalInMs?: number;
sendOperation: SendOperationFn<TResult>;
}

// @public (undocumented)
export interface LROResponseInfo {
// (undocumented)
azureAsyncOperation?: string;
// (undocumented)
isInitialRequest?: boolean;
// (undocumented)
location?: string;
// (undocumented)
operationLocation?: string;
// (undocumented)
provisioningState?: string;
// (undocumented)
requestMethod: HttpMethods;
// (undocumented)
status?: string;
// (undocumented)
statusCode: number;
}

// @public (undocumented)
export interface LROStrategy<TResult extends BaseResult> {
// (undocumented)
isTerminal: () => boolean;
// (undocumented)
poll: () => Promise<LROOperationStep<TResult>>;
// (undocumented)
sendFinalRequest: () => Promise<LROOperationStep<TResult>>;
}

// @public
export interface Match {
confidenceScore: number;
Expand All @@ -170,6 +347,22 @@ export enum PiiEntityDomainType {
PROTECTED_HEALTH_INFORMATION = "PHI"
}

// @public (undocumented)
export type PiiTask = TextAnalyticsTask & {
parameters?: PiiTaskParameters;
};

// @public (undocumented)
export interface PiiTaskParameters {
// (undocumented)
domain?: PiiTaskParametersDomain;
// (undocumented)
modelVersion?: string;
}

// @public
export type PiiTaskParametersDomain = "phi" | "none";

// @public
export type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;

Expand Down Expand Up @@ -233,6 +426,9 @@ export interface RecognizePiiEntitiesSuccessResult extends TextAnalyticsSuccessR
redactedText: string;
}

// @public (undocumented)
export type SendOperationFn<TResult extends BaseResult> = (args: OperationArguments, spec: OperationSpec) => Promise<TResult>;

// @public (undocumented)
export interface SentenceOpinion {
confidenceScores: AspectConfidenceScoreLabel;
Expand Down Expand Up @@ -264,9 +460,24 @@ export interface SentimentConfidenceScores {
positive: number;
}

// @public (undocumented)
export type SentimentTask = TextAnalyticsTask & {
parameters?: SentimentTaskParameters;
};

// @public (undocumented)
export interface SentimentTaskParameters {
// (undocumented)
modelVersion?: string;
// (undocumented)
opinionMining?: boolean;
}

// @public
export class TextAnalyticsClient {
constructor(endpointUrl: string, credential: TokenCredential | KeyCredential, options?: TextAnalyticsClientOptions);
analyze(documents: string[], tasks: JobManifestTasks, language?: string, options?: AnalyzeOptions): Promise<LROPoller<GeneratedClientAnalyzeResponse>>;
analyze(documents: TextDocumentInput[], tasks: JobManifestTasks, options?: AnalyzeOptions): Promise<LROPoller<GeneratedClientAnalyzeResponse>>;
analyzeSentiment(documents: string[], language?: string, options?: AnalyzeSentimentOptions): Promise<AnalyzeSentimentResultArray>;
analyzeSentiment(documents: TextDocumentInput[], options?: AnalyzeSentimentOptions): Promise<AnalyzeSentimentResultArray>;
defaultCountryHint: string;
Expand Down Expand Up @@ -320,6 +531,12 @@ export interface TextAnalyticsSuccessResult {
readonly warnings: TextAnalyticsWarning[];
}

// @public (undocumented)
export interface TextAnalyticsTask {
// (undocumented)
enable: boolean;
}

// @public
export interface TextAnalyticsWarning {
code: WarningCode;
Expand Down
35 changes: 33 additions & 2 deletions sdk/textanalytics/ai-text-analytics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ export {
RecognizePiiEntitiesOptions,
RecognizeLinkedEntitiesOptions,
TextAnalyticsOperationOptions,
PiiEntityDomainType
PiiEntityDomainType,
AnalyzeOptions,
JobManifestTasks,
EntitiesTaskParameters,
EntitiesTask,
PiiTask,
PiiTaskParameters,
EntityLinkingTask,
EntityLinkingTaskParameters,
SentimentTask,
SentimentTaskParameters,
CustomEntitiesTask,
CustomEntitiesTaskParameters
} from "./textAnalyticsClient";
export {
DetectLanguageResult,
Expand Down Expand Up @@ -84,5 +96,24 @@ export {
TextAnalyticsWarning,
TokenSentimentValue,
AspectConfidenceScoreLabel,
SentenceOpinion
SentenceOpinion,
CustomClassificationTask,
TextAnalyticsTask,
KeyPhrasesTask,
PiiTaskParametersDomain,
KeyPhrasesTaskParameters,
CustomClassificationTaskParameters,
GeneratedClientAnalyzeResponse,
GeneratedClientAnalyzeHeaders
} from "./generated/models";

export { LROPoller, LROPollerOptions, SendOperationFn } from "./generated/lro/lroPoller";

export {
BaseResult,
LROOperationState,
LROResponseInfo,
FinalStateVia,
LROOperationStep,
LROStrategy
} from "./generated/lro/models";
Loading

0 comments on commit d93c161

Please sign in to comment.