Skip to main content

TextStatisticsTransformer

Document content analysis and statistical metadata generation.

Notes

This feature analyzes the content of the supplied document and adds statistical information as metadata fields. Default behavior provide the statistics about the content. Refer to the following for the new metadata fields to be created along with their description.

Statistic fields

Field nameDescription
document.stat.characterCountTotal number of characters (excluding carriage returns/line feed).
document.stat.wordCountTotal number of words.
document.stat.sentenceCountTotal number of sentences.
document.stat.paragraphCountTotal number of paragraphs.
document.stat.averageWordCharacterCountAverage number of characters in every word.
document.stat.averageSentenceCharacterCountAverage number of characters in sentences (including non-word characters, such as spaces or slashes).
document.stat.averageSentenceWordCountAverage number of words per sentence.
document.stat.averageParagraphCharacterCountAverage number of characters in paragraphs (including non-word characters, such as spaces or slashes).
document.stat.averageParagraphSentenceCountAverage number of sentences per paragraph.
document.stat.averageParagraphWordCountAverage number of words per paragraph.

You can specify a field matcher to obtain statistics about matching fields instead. When you do so, the field name will be inserted in the above names, right after document.stat.. E.g.: document.stat.myfield.characterCount

Can be used both as a pre-parse (text-only) or post-parse handler.

Examples

The following example create statistics from the value of a field called "statistics".

handler:
class: TextStatisticsTransformer
fieldMatcher:
pattern: statistics

Usage

Full configuration skeleton, with every option and its default
class: TextStatisticsTransformer
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
label: string
sourceCharset: string

Properties

PropertyTypeRequiredDefault
fieldMatcherTextMatcherNoTextMatcher
labelstringNo-
sourceCharsetstringNo-

Property Details

fieldMatcher

Matches document fields based on specified patterns and methods

label

An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.

sourceCharset

Sets the character encoding of the source document to ensure proper reading and processing.