Document Capture Line Object Members in SuiteScript 2.1

Line object members in SuiteScript 2.1 include confidence levels and text extraction capabilities, enhancing document processing.

·2 min read·View Oracle Docs

The Line object within the document capture context in SuiteScript provides key member properties that can be leveraged by developers for improved document processing. This includes the confidence levels of extracted text, allowing scripts to filter results based on reliability.

What Are Line Object Members?

Line object members represent properties related to the lines of text extracted from documents, particularly when using the N/documentCapture module in SuiteScript 2.1. The two primary members are:

Member NameReturn TypeSupported Script TypesDescription
Line.confidencenumberServer scriptsThe confidence level for the line.
Line.textstringServer scriptsThe actual text of the line.

Understanding the Line.confidence

The Line.confidence property is a numerical value ranging from 0 to 1, representing the service's certainty about the accuracy of the extracted line text. For example, a value of 0.95 indicates that the service is 95% confident regarding the accuracy of the corresponding text. Developers can utilize this value to set thresholds for accepting or rejecting text lines in their scripts, thereby minimizing the risk of error. For instance, one might only pursue lines with a confidence greater than 0.9.

Implementing Line.text

The Line.text property provides the actual extracted text from the document line. This text can be utilized in various script processes, including data validation and storage.

Error Handling

Both properties are read-only, meaning developers cannot assign values to them, which helps maintain data integrity. The error code READ_ONLY is thrown if any attempts are made to modify these properties.

Sample Syntax

Below are syntax examples demonstrating how to utilize these members.

Example for Line.confidence

suitescript
1// Code snippet to accept or reject a line based on confidence level
2const extractedData = documentCapture.documentToStructure({
3 file: file.load("SuiteScripts/sample_invoice.pdf"),
4 documentType: documentCapture.DocumentType.INVOICE,
5 features: [documentCapture.Feature.TEXT_EXTRACTION]
6});
7
8const lineToProcess = extractedData.pages[0].lines[0];
9
10if (lineToProcess.confidence > 0.9) {
11 // Accept the line
12} else {
13 // Reject the line
14}

Example for Line.text

suitescript
1// Code snippet to retrieve line text
2const extractedData = documentCapture.documentToStructure({
3 file: file.load("SuiteScripts/sample_parking_application.pdf"),
4 documentType: documentCapture.DocumentType.OTHERS,
5 features: [documentCapture.Feature.TEXT_EXTRACTION]
6});
7
8const lineText = extractedData.pages[0].lines[0].text;
9// Use lineText as needed

In summary, the Line object members in SuiteScript 2.1 enhance the functionality of document processing by providing reliable mechanisms for text extraction and validation based on confidence levels, thus simplifying the automation of document-related tasks.

Frequently Asked Questions (4)

How can I utilize the confidence property in SuiteScript 2.1 to filter extracted text lines?
You can use the Line.confidence property to determine the reliability of extracted text lines by comparing its numerical value, which ranges from 0 to 1, against a threshold to decide if the text should be accepted or rejected.
Are there any error handling considerations when working with Line object members in SuiteScript 2.1?
Yes, both Line.confidence and Line.text properties are read-only and cannot be modified. Attempting to change their values will throw a READ_ONLY error.
What script types support the use of Line object members in SuiteScript 2.1?
Line object members, such as Line.confidence and Line.text, are supported in server scripts within the SuiteScript 2.1 environment.
Is it possible to modify the text extracted using the Line.text property in SuiteScript 2.1?
No, the Line.text property is read-only, so you cannot modify the extracted text. You can only use it as provided.
Source: Line Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Platform

View all Platform articles →