Lingua::FreeLing3::Splitter - Interface to FreeLing3 Splitter
use Lingua::FreeLing3::Splitter; use Lingua::FreeLing3::Tokenizer; my $pt_tok = Lingua::FreeLing3::Tokenizer->new("pt"); my $pt_split = Lingua::FreeLing3::Splitter->new("pt"); # compute list of Lingua::FreeLing3::Words my $list_of_words = $pt_tok->tokenize( $text ); my $list_of_sentences = $pt_split->split($list_of_words);
Interface to the FreeLing3 splitter library.
new
Object constructor. One argument is required: the languge code (Lingua::FreeLing3 will search for the splitter data file).
Lingua::FreeLing3
Returns the splitter object for that language, or undef in case of failure.
split
This is the only available method for the splitter object. It receives a list of Lingua::FreeLing3::Word objects (you can obtain one using the Lingua::FreeLing3::Tokenizer), and splits the text to a list of sentences.
Without any further configuration option, it will return a reference to a list of Lingua::FreeLing3::Sentence. The option to_text can be set, and it will return a reference to a list of strings, where the words/tokens will be separated by a simple space.
to_text
$list_of_sentences = $pt_split->split($list_of_words, to_text => 1 )
The buffered option can also be set to the value 0 if the function should not buffer tokens while processing. The default is to buffer.
buffered
0
$list_of_sentences = $pt_split->split($list_of_words, buffered => 0 )
NOTE: Before exiting, your application you should run the split method without the buffered feature, so that all the text is really processed!
Lingua::FreeLing3(3) for the documentation table of contents. The freeling library for extra information, or perl(1) itself.
Alberto Manuel Brandão Simões, <ambs@cpan.org>
Jorge Cunha Mendes <jorgecunhamendes@gmail.com>
Copyright (C) 2011 by Projecto Natura
To install Lingua::FreeLing3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::FreeLing3
CPAN shell
perl -MCPAN -e shell install Lingua::FreeLing3
For more information on module installation, please visit the detailed CPAN module installation guide.