NAME
Lingua::famibeib::Text - module to interact with the famibeib texts
VERSION
version v0.01
SYNOPSIS
use Lingua::famibeib::Text;
my Lingua::famibeib::Text $text = Lingua::famibeib::Text->new;
$text->parse_string('baba fafoof ba');
$text->parse_done;
my @fragments = $text->fragments;
This module is used to store and parse larger blocks of text.
This module inherits from Data::Identifier::Interface::Subobjects.
new
my Lingua::famibeib::Text $text = Lingua::famibeib::Text->new;
(since v0.01)
Creates a new text object. No options are currently supported.
fragments
my @fragments = $text->fragments;
(since v0.01)
Returns all complete fragments.
Each element returned is a Lingua::famibeib::Fragment or a plain string. Plain strings are returned for parts the parser could not make sense of.
parse_string
$text->parse_string($string);
(since v0.01)
Parses a string and adds it to the input queue. It is fine for the string to contain incomplete sentences. However, it is not permitted to contain incomplete words.
This method can be called over and over again to add more text.
The parser will try to split the string into useful fragments (sentences), but might generate smaller fragments if can't do it for some reason.
Note: The input string ($string) must be a plain perl string, not a byte string. If you need to apply any encoding you must do this before.
Returns $text (experimental since v0.01).
parse_done
$text->parse_done;
(since v0.01)
Tell the parser that parsing is done and all buffers should be flushed. Without calling this not all of the parsed text might be visible.
It is possible restart parsing new text. In that case the next text will not have any overlapping fragments with the last parse run.
Returns $text (experimental since v0.01).
as_string
my $str = $text->as_string;
(since v0.01)
Returns the current text as a string.
AUTHOR
Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2025 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)