NAME

App::Greple::xlate::Text - text normalization interface

SYNOPSIS

my $obj = App::Greple::xlate::Text->new($text, paragraph => 1);
my $normalized = $obj->normalized;

$result = process($normalized);

$obj->unstrip($result);

DESCRIPTION

This is an interface used within App::Greple::xlate to normalize text.

To get the normalized text, use the normalized method.

During normalization process, any whitespace at the beginning and the end of the line is removed. Therefore, the result of processing the normalized text does not preserve the whitespace in the original string; the unstrip method can be used to restore the removed whitespace.

METHODS

new

Creates an object. The first parameter is the original string; the second and subsequent parameters are pairs of attribute name and values.

paragraph

Specifies whether or not the text should be treated as a paragraph.

If true, multiple lines are concatenated into a single line.

If false, multiple strings are processed as they are.

In both cases, leading and trailing whitespace is stripped from each line.

normalized()

Returns a normalized string.

unstrip($text)

Recover removed white spaces from normalized text or corresponding cooked text.

If not in paragraph mode, the string to be processed must have the same number of lines as the original string.

text

Retrieve original text.