section_document
The section_document
function divides the content of a document into shorter sections.
Syntax
section_document( doc [, params] )
Arguments
Argument | Description |
---|---|
doc
|
(LuaDocument) The document that you want to section. |
params
|
(table) Additional named parameters that configure the task. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. For information about how to use named parameters refer to the Connector Framework Server Administration Guide. |
Named Parameters
Named Parameter | Description | Configuration Parameter |
---|---|---|
section
|
(string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the parameters table are read from this section of the configuration file. | |
min_section_length
|
(integer) The minimum number of characters in each section. The default is 1500. | SectionerMinBytes |
max_section_length |
(integer) The maximum number of characters in each section. The default is 3000. | SectionerMaxBytes |
separators
|
(table) A list of strings (from high to low importance) that specify points in the document content where the document can be divided. The default is a list of punctuation characters. You can use regular expressions. | SectionerSeparatorsN |
mandatory_separators
|
(strings) A comma-separated list of separators. The document content is split at every occurrence of any of these separators. There are no default mandatory separators. | MandatorySeparators |
max_sections
|
(integer) The maximum number of sections to create. If the maximum number of sections is reached, any remaining content is left in a single block. The default is 10000. | MaxSections |
Returns
Boolean. Returns true
if the document is divided successfully.
Example
function handler(document) -- This call will use 2000 for the minimum output section -- length, read the rest of the parameter from the -- section 'sectioner_parameters_section' in the CFS -- configuration file, and use the defaults for any -- not provided as a named parameter there. return section_document(document, {section = "sectioner_parameters_section", min_section_length = 2000}) end