0

When I create the W2 parser in the console, it provides a key-value pair of form details. How can I achieve the same in code? Is there any documentation available for C# or any other language?

I've tried the ProcessDocument request using c# client library for w2 parser but it's not providing the key value pair like form parser. It's providing full text format like OCR processor.

1 Answers1

0

This page in the documentation shows how the output for specialized entity extraction processors (like W2 Parser) is structured.

https://cloud.google.com/document-ai/docs/handle-response#entities

This code sample shows how to send a processing request for C#, but it is written to just print out the document text, not any other fields.

https://cloud.google.com/document-ai/docs/process-documents-client-libraries#client-libraries-usage-csharp

There are also code samples in Java, Node.JS, and Python showing how to parse this response to get the entities directly. You can follow the same logic to parse the document response and get the entity fields.

https://cloud.google.com/document-ai/docs/handle-response#code_samples_3

This is the C# Client Library Reference for Document AI so you can see the object structure and field names.

https://cloud.google.com/dotnet/docs/reference/Google.Cloud.DocumentAI.V1/latest

Holt Skinner
  • 1,692
  • 1
  • 8
  • 21
  • Thanks Holt. I am able to get the key-value pairs of the W2 form from the Entity field using the C# library – Divyasri D Aug 11 '23 at 11:49