Coder Social home page Coder Social logo

kmascar / amazon-textract-response-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/amazon-textract-response-parser

0.0 0.0 0.0 10.91 MB

Parse JSON response of Amazon Textract

License: Apache License 2.0

Python 43.40% C# 4.36% JavaScript 1.48% TypeScript 50.76%

amazon-textract-response-parser's Introduction

Textract Response Parser

You can use Textract response parser library to easily parse JSON returned by Amazon Textract. The library parses JSON and provides programming language specific constructs to work with different parts of the document. textractor is an example of a PoC batch processing tool that takes advantage of the Textract response parser library and generates output in multiple formats.

Python Usage

For documentation on usage see: src-python/README.md

JavaScript/TypeScript Usage

For documentation on usage see: src-js/README.md

C# Usage

Forms

document.Pages.ForEach(page => {
    Console.WriteLine("Print Lines and Words:");
    page.Lines.ForEach(line => {
        Console.WriteLine("{0}--{1}", line.Text, line.Confidence);
        line.Words.ForEach(word => {
            Console.WriteLine("{0}--{1}", word.Text, word.Confidence);
        });
    });
    Console.WriteLine("Print Fields:");
    page.Form.Fields.ForEach(f => {
        Console.WriteLine("Field: Key: {0}, Value {1}", f.Key, f.Value);
    });
    Console.WriteLine("Get Field by Key:");
    var key = "Phone Number:";
    var field = page.Form.GetFieldByKey(key);
    if(field != null) {
        Console.WriteLine("Field: Key: {0}, Value: {1}", field.Key, field.Value);
    }
});

Tables

document.Pages.ForEach(page => {
    page.Tables.ForEach(table => {
        var r = 0;
        table.Rows.ForEach(row => {
            r++;
            var c = 0;
            row.Cells.ForEach(cell => {
                c++;
                Console.WriteLine("Table [{0}][{1}] = {2}--{3}", r, c, cell.Text, cell.Confidence);
            });
        });
    });
});

Check out the src-csharp folder for instructions on how to run .NET Core C# samples

Other Resources

License Summary

This sample code is made available under the Apache License V2.0 license. See the LICENSE file.

amazon-textract-response-parser's People

Contributors

athewsey avatar avisaws avatar cgarces avatar darwaishx avatar dependabot[bot] avatar dhawalkp avatar douglasqian avatar jmalha avatar kmascar avatar mehran22000 avatar michaelwalker-git avatar mvonlanthen avatar richardscottoz avatar sahays avatar schadem avatar seanstrom avatar stevenmapes avatar tb102122 avatar victormartingarcia avatar yuajia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.