Learn R Programming

daiR (version 1.0.0)

get_text: Get text

Description

Extracts the text OCRed by Document AI (DAI)

Usage

get_text(
  object,
  type = "sync",
  save_to_file = FALSE,
  dest_dir = getwd(),
  outfile_stem = NULL
)

Value

a string (if save_to_file = FALSE)

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.

save_to_file

boolean; whether to save the text as a .txt file

dest_dir

folder path for the .txt output file if save_to_file = TRUE

outfile_stem

string to form the stem of the .txt output file

Examples

Run this code
if (FALSE) {
text <- get_text(dai_sync("file.pdf"))

text <- get_text("file.json", type = "async", save_to_file = TRUE)
}

Run the code above in your browser using DataLab