Word Object Members
Explore Word object members in SuiteScript 2.1 for text extraction and confidence processing in document capture.
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 Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Word.confidence | number | Server scripts | Indicates the confidence level of the extracted word. |
Word.text | string | Server scripts | Contains 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 of0.95implies 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:
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 word11} else {12 // Reject the word13}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.confidenceproperty 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?
What types of scripts support the Word object members in SuiteScript 2.1?
What error might occur when using the Word object properties, and how can it be avoided?
Is it possible to modify the text contained in the Word.text property?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
