Skip to content

Commit

Permalink
[FormRecognizer] rename includeTextDetails to includeTextContent (#9486)
Browse files Browse the repository at this point in the history
* [FormRecognizer] rename includeTextDetails to includeTextContent

in the custom form/receipt recognition options.  This was missed in the
consistency push.

* Update changelog
  • Loading branch information
jeremymeng authored Jun 11, 2020
1 parent 92512a2 commit 1bb378e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions sdk/formrecognizer/ai-form-recognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.0.0-preview.4 (Unreleased)

- [Breaking] Rename `includeTextDetails` to `includeTextContent` in custom form and receipt recognition options to be consistent with other languages.

## 1.0.0-preview.3 (2020-06-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export interface RecognizedReceiptArray extends Array<RecognizedReceipt> {

// @public
export type RecognizeFormsOptions = FormRecognizerOperationOptions & {
includeTextDetails?: boolean;
includeTextContent?: boolean;
};

// @public
Expand All @@ -534,7 +534,7 @@ export type RecognizeReceiptPollerClient = {

// @public
export type RecognizeReceiptsOptions = FormRecognizerOperationOptions & {
includeTextDetails?: boolean;
includeTextContent?: boolean;
};

export { RestResponse }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function main() {
"https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/contoso-allinone.jpg";

const poller = await client.beginRecognizeReceiptsFromUrl(url, {
includeTextDetails: true,
includeTextContent: true,
onProgress: (state) => {
console.log(`analyzing status: ${state.status}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function main() {
"https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/contoso-allinone.jpg";

const poller = await client.beginRecognizeReceiptsFromUrl(url, {
includeTextDetails: true,
includeTextContent: true,
onProgress: (state) => {
console.log(`analyzing status: ${state.status}`);
}
Expand Down
18 changes: 12 additions & 6 deletions sdk/formrecognizer/ai-form-recognizer/src/formRecognizerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export type RecognizeFormsOptions = FormRecognizerOperationOptions & {
/**
* Specifies whether to include text lines and element references in the result
*/
includeTextDetails?: boolean;
includeTextContent?: boolean;
};

/**
Expand Down Expand Up @@ -165,7 +165,7 @@ export type RecognizeReceiptsOptions = FormRecognizerOperationOptions & {
/**
* Specifies whether to include text lines and element references in the result
*/
includeTextDetails?: boolean;
includeTextContent?: boolean;
};

/**
Expand Down Expand Up @@ -646,7 +646,7 @@ ng", and "image/tiff";
* const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
* const poller = await client.beginRecognizeReceiptsFromUrl(
* url, {
* includeTextDetails: true,
* includeTextContent: true,
* onProgress: (state) => { console.log(`analyzing status: ${state.status}`); }
* });
* await poller.pollUntilDone();
Expand Down Expand Up @@ -789,7 +789,10 @@ async function recognizeCustomFormInternal(
options: RecognizeFormsOptions = {},
modelId?: string
): Promise<AnalyzeWithCustomModelResponseModel> {
const { span, updatedOptions: finalOptions } = createSpan("analyzeCustomFormInternal", options);
const { span, updatedOptions: finalOptions } = createSpan("analyzeCustomFormInternal", {
...options,
includeTextDetails: options.includeTextContent
});
const requestBody = await toRequestBody(body);
const requestContentType = contentType ? contentType : await getContentType(requestBody);

Expand Down Expand Up @@ -827,8 +830,11 @@ async function recognizeReceiptInternal(
options?: RecognizeReceiptsOptions,
_modelId?: string
): Promise<AnalyzeReceiptAsyncResponseModel> {
const realOptions = options || { includeTextDetails: false };
const { span, updatedOptions: finalOptions } = createSpan("analyzeReceiptInternal", realOptions);
const realOptions = options || { includeTextContent: false };
const { span, updatedOptions: finalOptions } = createSpan("analyzeReceiptInternal", {
...realOptions,
includeTextDetails: realOptions.includeTextContent
});
const requestBody = await toRequestBody(body);
const requestContentType =
contentType !== undefined ? contentType : await getContentType(requestBody);
Expand Down
8 changes: 4 additions & 4 deletions sdk/formrecognizer/ai-form-recognizer/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export interface FormTableCell {
*/
confidence: number;
/**
* When includeTextDetails is set to true, a list of references to the text elements constituting this table cell.
* When includeTextContent is set to true, a list of references to the text elements constituting this table cell.
*/
textContent?: FormContent[];
/**
Expand Down Expand Up @@ -208,7 +208,7 @@ export interface FieldText {
*/
boundingBox?: Point2D[];
/**
* When includeTextDetails is set to true, a list of references to the text elements constituting this name or value.
* When includeTextContent is set to true, a list of references to the text elements constituting this name or value.
*/
textContent?: FormContent[];
/**
Expand Down Expand Up @@ -294,7 +294,7 @@ export interface FormPage {
*/
// language?: Language;
/**
* When includeTextDetails is set to true, a list of recognized text lines. The maximum number of
* When includeTextContent is set to true, a list of recognized text lines. The maximum number of
* lines returned is 300 per page. The lines are sorted top to bottom, left to right, although in
* certain cases proximity is treated with higher priority. As the sorting order depends on the
* detected text, it may change across images and OCR version updates. Thus, business logic
Expand Down Expand Up @@ -356,7 +356,7 @@ export interface CommonFieldValue {
*/
confidence?: number;
/**
* When includeTextDetails is set to true, a list of references to the text elements constituting
* When includeTextContent is set to true, a list of references to the text elements constituting
* this field.
*/
textContent?: FormContent[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe("FormRecognizerClient NodeJS only", () => {
const stream = fs.createReadStream(filePath);

const poller = await client.beginRecognizeReceipts(stream, "application/pdf", {
includeTextDetails: true
includeTextContent: true
});
await poller.pollUntilDone();
const receipts = poller.getResult();
Expand Down

0 comments on commit 1bb378e

Please sign in to comment.