Word Object Members

Explore Word object members in SuiteScript 2.1 for text extraction and confidence processing in document capture.

·2 min read·1 views·View Oracle Docs

The Word object in SuiteScript 2.1 includes key members for processing extracted text from documents. These members allow developers to utilize confidence levels and text strings effectively, facilitating more accurate document handling in NetSuite applications.

What Are Word Object Members?

Word object members consist of properties that provide details about text extracted from documents processed via the document capture features in SuiteScript. Two main properties are defined for this object:

Member NameReturn TypeSupported Script TypesDescription
Word.confidencenumberServer scriptsIndicates the confidence level of the extracted word.
Word.textstringServer scriptsContains the actual text of the extracted word.

Detailed Description of Properties

Confidence Property

  • Word.confidence: This property returns a number between 0 and 1, reflecting the confidence level of the extracted text. For instance, a value of 0.95 implies a 95% confidence in the word's accuracy. Developers can use this property to set acceptance thresholds, filtering out lower-confidence words to minimize errors.

Text Property

  • Word.text: This property fetches the actual text that has been extracted from the document. It is important for cases where precise text representation is necessary for further processing.

Error Handling

Errors can arise while processing these properties, notably:

  • READ_ONLY: Triggered when attempting to set values for these properties, which are designed to be read-only.

Example Usage in SuiteScript

Here’s a syntax example illustrating how to work with Word object members in SuiteScript:

suitescript
1const extractedData = documentCapture.documentToStructure({
2 file: file.load("SuiteScripts/sample_parking_application.pdf"),
3 documentType: documentCapture.DocumentType.OTHERS,
4 features: [documentCapture.Feature.TEXT_EXTRACTION]
5});
6
7const wordToProcess = extractedData.pages[0].words[0];
8
9if (wordToProcess.confidence > 0.9) {
10 // Accept the word
11} else {
12 // Reject the word
13}

In this example, the script checks the confidence level of the first word extracted from a document. If the confidence is over 0.9, it accepts the word; otherwise, it rejects it.

Who This Affects

This content is particularly relevant for:

  • Developers who implement document processing features using SuiteScript.
  • Administrators managing configurations related to document capture and text extraction processes.

Key Takeaways

  • Word object members in SuiteScript 2.1 are essential for handling text extraction from documents.
  • The Word.confidence property assists in establishing thresholds to ensure data accuracy.
  • Developers should handle read-only properties carefully to avoid runtime errors.

Frequently Asked Questions (4)

How can I use the Word.confidence property in SuiteScript 2.1?
The Word.confidence property returns a value between 0 and 1, representing the confidence level of the extracted word's accuracy. You can use this to set acceptance thresholds and filter out words with lower confidence to minimize errors in processing.
What types of scripts support the Word object members in SuiteScript 2.1?
The Word object members, such as Word.confidence and Word.text, are supported in server scripts within SuiteScript 2.1.
What error might occur when using the Word object properties, and how can it be avoided?
Attempting to set values for Word object properties will trigger a 'READ_ONLY' error since these properties are read-only. Ensure you only read these properties to avoid such runtime errors.
Is it possible to modify the text contained in the Word.text property?
No, the Word.text property is read-only and is only meant to fetch the actual extracted text from a document, not for modification.
Source: Word 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 Integration

View all Integration articles →