textract-filters

0.0.8 • Public • Published

textract-filters

A simple filter to AWS Textract results.

Installation

npm install textract-filters

Usage

Example of usage with comments.

const {
    Table,
    Box,
    Type,
    Key
} = require('textract-filters');

const mock = require('./mock.json');
const blocks = mock.Blocks; // Get blocks of result

const titleBox = new Box(
    0.0447581522166729,
    0.2651977241039276,
    0.07229408621788025,
    0.4745683968067169
); // Define box borders

const titleBoxBlocks = titleBox.filter(blocks); // Get blocks inside box

const typeFilter = new Type('LINE'); // Create filter to lines

const titleLine = typeFilter.filter(titleBoxBlocks); // Filter lines of box

console.log("Title Line", titleLine[0]); 

const table = new Table(blocks, {
    tableId: 'ae7fe756-f865-4252-85e3-e2a94350cad0'
}); // Get tables by tableId

const tableRows = table.rows(); // Get rows of table
console.log(tableRows);

const fullName = new Key(blocks, {
    searchKey: 'Full Name:'
}); // Create full name key

console.log("Full name: ", fullName.getValue()); // Get value of key

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i textract-filters

Weekly Downloads

16

Version

0.0.8

License

ISC

Unpacked Size

9.28 kB

Total Files

7

Last publish

Collaborators

  • manbomb