Lingua::FreeLing3::Sentence - Interface to FreeLing3 Sentence object
use Lingua::FreeLing3::Sentence; # usually you don't need to construct sentences. # the constructor also accepts a list of Lingua::FreeLing3::Word's my $sentence = Lingua::FreeLing3::Sentence->new("some","sentence"); my $size = $sentence->length; # returns 2 # returns array of Lingua::FreeLing3::Word objects my @words = $sentence->words; # returns string with words separated by spaces my $string = $sentence->to_text; if ($sentence->is_parsed) { # returns Lingua::FreeLing3::ParseTree my $parse_tree = $sentence->parse_tree; } if ($sentence->is_dep_parsed) { # returns Lingua::FreeLing3::DepTree my $dep_tree = $sentence->dep_tree; } my $iterator = $sentence->iterator;
This module is a wrapper to the FreeLing3 Sentence object (a list of words, that someone has validated as a complete sentence.
new
The constructor returns a new Sentence object. Can be initialized with an array of words (strings) or an array of Lingua::FreeLing3::Word objects (or a mixture of them).
length
Returns the sentence length (number of words/tokens).
words
Returns a list of Lingua::FreeLing3::Word.
word
Returns the nth word.
to_text
Returns a string with words separated by a blank space.
is_parsed
Checks if the sentence has been parsed by a parser.
parse_tree
Returns the current parse tree, if there is any.
is_dep_parsed
Checks if the sentence has been parsed by a dependency parser.
dep_tree
Returns the current dependency tree, if there is any.
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>
Copyright (C) 2011-2012 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.