Skip to content

Commit

Permalink
Add ocr results in AnalyzeIDResponse as blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sdk-dotnet-automation committed Nov 1, 2022
1 parent 8b02763 commit dc85a20
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@
"type":"structure",
"members":{
"DocumentIndex":{"shape":"UInteger"},
"IdentityDocumentFields":{"shape":"IdentityDocumentFieldList"}
"IdentityDocumentFields":{"shape":"IdentityDocumentFieldList"},
"Blocks":{"shape":"BlockList"}
}
},
"IdentityDocumentField":{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
"DetectDocumentTextResponse$Blocks": "<p>An array of <code>Block</code> objects that contain the text that's detected in the document.</p>",
"ExpenseDocument$Blocks": "<p>This is a block object, the same as reported when DetectDocumentText is run on a document. It provides word level recognition of text.</p>",
"GetDocumentAnalysisResponse$Blocks": "<p>The results of the text-analysis operation.</p>",
"GetDocumentTextDetectionResponse$Blocks": "<p>The results of the text-detection operation.</p>"
"GetDocumentTextDetectionResponse$Blocks": "<p>The results of the text-detection operation.</p>",
"IdentityDocument$Blocks": "<p>Individual word recognition, as returned by document detection.</p>"
}
},
"BlockType": {
Expand Down Expand Up @@ -217,7 +218,7 @@
}
},
"ExpenseGroupProperty": {
"base": "<p>Shows the group that a certain key belongs to. This helps differentiate responses like addresses that can appear similar in response JSON.</p>",
"base": "<p>Shows the group that a certain key belongs to. This helps differentiate between names and addresses for different organizations, that can be hard to determine via JSON response.</p>",
"refs": {
"ExpenseGroupPropertyList$member": null
}
Expand Down Expand Up @@ -713,7 +714,7 @@
"AnalyzeIDResponse$AnalyzeIDModelVersion": "<p>The version of the AnalyzeIdentity API being used to process documents.</p>",
"Block$Text": "<p>The word or line of text that's recognized by Amazon Textract. </p>",
"DetectDocumentTextResponse$DetectDocumentTextModelVersion": "<p/>",
"ExpenseCurrency$Code": "<p>Currency code for detected currency.</p>",
"ExpenseCurrency$Code": "<p>Currency code for detected currency. the current supported codes are:</p> <ul> <li> <p>USD</p> </li> <li> <p>EUR</p> </li> <li> <p>GBP</p> </li> <li> <p>CAD</p> </li> <li> <p>INR</p> </li> <li> <p>JPY</p> </li> <li> <p>CHF</p> </li> <li> <p>AUD</p> </li> <li> <p>CNY</p> </li> <li> <p>BZR</p> </li> <li> <p>SEK</p> </li> <li> <p>HKD</p> </li> </ul>",
"ExpenseDetection$Text": "<p>The word or line of text recognized by Amazon Textract</p>",
"ExpenseGroupProperty$Id": "<p>Provides a group Id number, which will be the same for each in the group.</p>",
"ExpenseType$Text": "<p>The word or line of text detected by Amazon Textract.</p>",
Expand All @@ -730,7 +731,7 @@
"StringList": {
"base": null,
"refs": {
"ExpenseGroupProperty$Types": "<p>Informs you on the kind of label associated with the group</p>"
"ExpenseGroupProperty$Types": "<p>Informs you on whether the expense group is a name or an address.</p>"
}
},
"TextType": {
Expand Down
10 changes: 7 additions & 3 deletions generator/ServiceModels/textract/textract-2018-06-27.normal.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
"members":{
"Code":{
"shape":"String",
"documentation":"<p>Currency code for detected currency.</p>"
"documentation":"<p>Currency code for detected currency. the current supported codes are:</p> <ul> <li> <p>USD</p> </li> <li> <p>EUR</p> </li> <li> <p>GBP</p> </li> <li> <p>CAD</p> </li> <li> <p>INR</p> </li> <li> <p>JPY</p> </li> <li> <p>CHF</p> </li> <li> <p>AUD</p> </li> <li> <p>CNY</p> </li> <li> <p>BZR</p> </li> <li> <p>SEK</p> </li> <li> <p>HKD</p> </li> </ul>"
},
"Confidence":{
"shape":"Percent",
Expand Down Expand Up @@ -658,14 +658,14 @@
"members":{
"Types":{
"shape":"StringList",
"documentation":"<p>Informs you on the kind of label associated with the group</p>"
"documentation":"<p>Informs you on whether the expense group is a name or an address.</p>"
},
"Id":{
"shape":"String",
"documentation":"<p>Provides a group Id number, which will be the same for each in the group.</p>"
}
},
"documentation":"<p>Shows the group that a certain key belongs to. This helps differentiate responses like addresses that can appear similar in response JSON.</p>"
"documentation":"<p>Shows the group that a certain key belongs to. This helps differentiate between names and addresses for different organizations, that can be hard to determine via JSON response.</p>"
},
"ExpenseGroupPropertyList":{
"type":"list",
Expand Down Expand Up @@ -980,6 +980,10 @@
"IdentityDocumentFields":{
"shape":"IdentityDocumentFieldList",
"documentation":"<p>The structure used to record information extracted from identity documents. Contains both normalized field and value of the extracted text.</p>"
},
"Blocks":{
"shape":"BlockList",
"documentation":"<p>Individual word recognition, as returned by document detection.</p>"
}
},
"documentation":"<p>The structure that lists each document processed in an AnalyzeID operation.</p>"
Expand Down
51 changes: 50 additions & 1 deletion sdk/src/Services/Textract/Generated/Model/ExpenseCurrency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,57 @@ public partial class ExpenseCurrency
/// <summary>
/// Gets and sets the property Code.
/// <para>
/// Currency code for detected currency.
/// Currency code for detected currency. the current supported codes are:
/// </para>
/// <ul> <li>
/// <para>
/// USD
/// </para>
/// </li> <li>
/// <para>
/// EUR
/// </para>
/// </li> <li>
/// <para>
/// GBP
/// </para>
/// </li> <li>
/// <para>
/// CAD
/// </para>
/// </li> <li>
/// <para>
/// INR
/// </para>
/// </li> <li>
/// <para>
/// JPY
/// </para>
/// </li> <li>
/// <para>
/// CHF
/// </para>
/// </li> <li>
/// <para>
/// AUD
/// </para>
/// </li> <li>
/// <para>
/// CNY
/// </para>
/// </li> <li>
/// <para>
/// BZR
/// </para>
/// </li> <li>
/// <para>
/// SEK
/// </para>
/// </li> <li>
/// <para>
/// HKD
/// </para>
/// </li> </ul>
/// </summary>
public string Code
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
namespace Amazon.Textract.Model
{
/// <summary>
/// Shows the group that a certain key belongs to. This helps differentiate responses
/// like addresses that can appear similar in response JSON.
/// Shows the group that a certain key belongs to. This helps differentiate between names
/// and addresses for different organizations, that can be hard to determine via JSON
/// response.
/// </summary>
public partial class ExpenseGroupProperty
{
Expand Down Expand Up @@ -58,7 +59,7 @@ internal bool IsSetId()
/// <summary>
/// Gets and sets the property Types.
/// <para>
/// Informs you on the kind of label associated with the group
/// Informs you on whether the expense group is a name or an address.
/// </para>
/// </summary>
public List<string> Types
Expand Down
19 changes: 19 additions & 0 deletions sdk/src/Services/Textract/Generated/Model/IdentityDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,28 @@ namespace Amazon.Textract.Model
/// </summary>
public partial class IdentityDocument
{
private List<Block> _blocks = new List<Block>();
private int? _documentIndex;
private List<IdentityDocumentField> _identityDocumentFields = new List<IdentityDocumentField>();

/// <summary>
/// Gets and sets the property Blocks.
/// <para>
/// Individual word recognition, as returned by document detection.
/// </para>
/// </summary>
public List<Block> Blocks
{
get { return this._blocks; }
set { this._blocks = value; }
}

// Check to see if Blocks property is set
internal bool IsSetBlocks()
{
return this._blocks != null && this._blocks.Count > 0;
}

/// <summary>
/// Gets and sets the property DocumentIndex.
/// <para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public IdentityDocument Unmarshall(JsonUnmarshallerContext context)
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("Blocks", targetDepth))
{
var unmarshaller = new ListUnmarshaller<Block, BlockUnmarshaller>(BlockUnmarshaller.Instance);
unmarshalledObject.Blocks = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("DocumentIndex", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
Expand Down

0 comments on commit dc85a20

Please sign in to comment.