Skip to main content

Get-All-Text

Command Description

Get all text from the Text OCR result

Command Prototype

sRet = Mage.ExtractAllText(jsonRet,include_enter)

Parameter Description

ParameterRequiredTypeDefaultDescription
jsonRetTrueexpressionjsonRetOutput variables from "Screen Text OCR", "Image Text OCR", "PDF Text OCR"
include_enterTruebooleanNoneWhether all the texts contain line ending; if yes, add at the end of each line, otherwise do not add

return

sRet,The variable used to save the output of the command.

Demo

Dim jsonRet = {"ai_function" : "ocr_text","items" : [{"char_positions" : [],"content" : "Pass the page number specified by the PDF through  Laiye  Intelligent Document Processing General text recognition, the recognition result returns JSON format","handwrite_info" : null,"importance_info" : null,"page_number" : 1,"positions" : [{" x" : 71,"y" : 60},{"x" : 522,"y" : 61},{"x" : 522,"y" : 75 },{"x" : 71,"y" : 74}],"probabilities" : []},{"char_positions" : [],"content" : ". In the process of identifying multiple pages, if one of the pages fails, the entire identification will return an error, and the quota will be consumed","handwrite_info" : null,"importance_info" : null,"page_number" : 1,"positions " : [{"x" : 72,"y" : 76},{"x" : 420,"y" : 76},{"x" : 420, "y" : 89},{"x" : 72,"y" : 89}],"probabilities" : []}],"struct_content" : {"page"  : [{"content" : "Recognize the page number specified by PDF through  Laiye Intelligent Document Processing  general text, and return the recognition result in JSON format. In the process of recognizing multiple pages, if one of the pages fails, the entire recognition will be performed. An error will be returned and the quota will be consumed","page_id" : 0,"page_number" : 1}],"paragraph" : [{"content" : "Pass the page number specified by the PDF through   Laiye Intelligent Document Processing General text recognition, the recognition result is returned in JSON format. In the process of recognizing multiple pages, if one of the pages fails, the entire recognition will return an error, and the quota will be consumed","page_number" : 1, "paragraph_id" : 0}],"row" : [{"content" : "Pass the page number specified by PDF through  La iye Intelligent Document Processing General text recognition, the recognition result returns JSON format ","page_number" : 1,"row_id" : 0},{"content" : ". In the process of identifying multiple pages, if one of the pages fails, the entire identification will return an error, and the quota will be consumed","page_number" : 1,"row_id" : 1}]}}  // Test data 

TracePrint "--------------------Get full text--------------------"
// --------------------------------------------------------
// [Remarks] Get all the text
// Input parameter 1:
// jsonRet--Use "screen text recognition", "image text recognition", "PDF text recognition" command output to the variable
// Input parameter 2:
// include_enter--Whether newline information is included in all texts, if "Yes", add \n after each line. "No" does not add

// Output parameters:
// sRet: The variable to which the output of the function call is saved

// Command prototype: sRet = Mage.ExtractAllText(jsonRet,include_enter)
// --------------------------------------------------------

sRet = Mage.ExtractAllText (jsonRet, false)
TracePrint (sRet)