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.

build_block_df(object, type = "sync")

Arguments

object

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

type

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

Value

a block data frame

Details

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

Examples

if (FALSE) { # \dontrun{
resp <- dai_sync("file.pdf")
block_df <- build_block_df(resp)

block_df <- build_block_df("pdf_output.json", type = "async")
} # }