build_block_df: Build block dataframe

View source: R/process_output.R

build_block_dfR Documentation

Build block dataframe

Description

Creates a dataframe with the block bounding boxes identified by Document AI (DAI) in an asynchronous request. Rows are blocks, in the order DAI proposes to read them. Columns are location variables such as page coordinates and page numbers.

Usage

build_block_df(type, output)

Arguments

type

one of "sync" or "async" depending on the function used to process the original document.

output

either a HTTP response object (from dai_sync()) or the path to a JSON file (from dai_async).

Details

The dataframe variables are: page number, block number, confidence score, left boundary, right boundary, top boundary, and bottom boundary.

Value

a block data frame

Examples

## Not run: 
block_df <- build_block_df(type = "async", output = "pdf_output.json")
resp <- dai_sync("file.pdf")
block_df <- build_block_df(type = "sync", output = resp)

## End(Not run)

daiR documentation built on Sept. 8, 2023, 5:43 p.m.