Connector Framework Server 26.3
Connector Framework Server Help

# has_sensible_word_lengths

The `has_sensible_word_lengths` function checks the average length of words in a document.

## Syntax

    has_sensible_word_lengths( doc
       [, minimumThreshold
       [, maximumThreshold
       [, checkedSegmentLength]]] )

## Arguments

Argument | Description
--- | ---
`doc` | (LuaDocument) The document that you want to check.
`minimumThreshold` | (float) The minimum average word length for the function to return `true`. The default is 3 characters.
`maximumThreshold` | (float) The maximum average word length for the function to return `true`. The default is 9 characters.
`checkedSegmentLength` | (integer) The number of characters in the document content that you want to check. By default, the function checks the average word length of the first 1000 characters.

## Returns

Boolean. Returns the result of the check.

## Example

Copy

    1
    2
    3
    4
    5
    6
    7
    8
    function handler(document)
       local is_sensible = has_sensible_word_lengths(
          document, 4.0, 7.0)

       if(!is_sensible)
          write_idx(document, "bad_word_length_documents.idx")
       return is_sensible
    end

Copyright 2026 Open Text
Version 26.3 | Last updated July 2026

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Connector Framework Server 26.3

Topic Title: has_sensible_word_lengths