-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reading order in recognizing content [Formrecognizer] (…
- Loading branch information
Showing
7 changed files
with
254 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...zure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/ReadingOrder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.ai.formrecognizer.models; | ||
|
||
/** | ||
* Defines values for ReadingOrder. | ||
*/ | ||
public enum ReadingOrder { | ||
|
||
/** | ||
* Enum value basic. | ||
* Set it to basic for the lines to be sorted top to bottom, left to right, although in certain cases | ||
* proximity is treated with higher priority. | ||
*/ | ||
BASIC("basic"), | ||
|
||
/** | ||
* Enum value natural. | ||
* Set it to "natural" value for the algorithm to use positional information to keep nearby lines together. | ||
*/ | ||
NATURAL("natural"); | ||
|
||
/** | ||
* The actual serialized value for a ReadingOrder instance. | ||
*/ | ||
private final String value; | ||
|
||
ReadingOrder(String value) { | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Parses a serialized value to a ReadingOrder instance. | ||
* | ||
* @param value the serialized value to parse. | ||
* @return the parsed ReadingOrder object, or null if unable to parse. | ||
*/ | ||
public static ReadingOrder fromString(String value) { | ||
ReadingOrder[] items = ReadingOrder.values(); | ||
for (ReadingOrder item : items) { | ||
if (item.toString().equalsIgnoreCase(value)) { | ||
return item; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...ion-records/FormRecognizerAsyncClientTest.recognizeContentWithReadingOrderNatural[1].json
Large diffs are not rendered by default.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...es/session-records/FormRecognizerAsyncClientTest.recognizeContentWithReadingOrder[1].json
Large diffs are not rendered by default.
Oops, something went wrong.