Extracts the text OCRed by Document AI (DAI)

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

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

Value

a string (if save_to_file = FALSE)

Examples

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

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