NAME

Lingua::FreeLing3::Sentence - Interface to FreeLing3 Sentence object

SYNOPSIS

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;

DESCRIPTION

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.

SEE ALSO

Lingua::FreeLing3(3) for the documentation table of contents. The freeling library for extra information, or perl(1) itself.

AUTHOR

Alberto Manuel Brandão Simões, <ambs@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011-2012 by Projecto Natura