Lingua-FreeLing3
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Lingua/FreeLing3/ParseTree.pm view on Meta::CPAN
package Lingua::FreeLing3::ParseTree;
use warnings;
use strict;
use Try::Tiny;
use Lingua::FreeLing3::Bindings;
use parent -norequire, 'Lingua::FreeLing3::Bindings::parse_tree';
our $VERSION = "0.02";
=encoding UTF-8
=head1 NAME
Lingua::FreeLing3::ParseTree - Interface to FreeLing3 ParseTree object
=head1 SYNOPSIS
use Lingua::FreeLing3::ParseTree;
$ptree = $sentence->parse_tree;
$node_info = $ptree->info;
=head1 DESCRIPTION
=cut
sub _new_from_binding {
my ($class, $word) = @_;
return bless $word => $class #amen
}
=head2 ACCESSORS
=over 4
=item C<word>
Returns the word in that parse tree node, if any.
=cut
sub word {
my $self = shift;
my $word = $self->SUPER::get_info->get_word;
if ($word) {
return Lingua::FreeLing3::Word->_new_from_binding($word);
}
return $word;
}
=item C<num_children>
Returns the number of childs for this tree node.
=cut
# inherited
=pod
=back
=head2 METHODS
=over 4
=item C<nth_child>
Returns the nth child.
=cut
sub nth_child {
my ($self, $n) = @_;
return Lingua::FreeLing3::ParseTree->_new_from_binding($self->SUPER::nth_child_ref($n));
}
=item C<dump>
Dumps the tree in a textual format, useful for debug purposes.
=cut
sub dump {
my $tree = shift;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.530 second using v1.00-cache-2.02-grep-82fe00e-cpan-3b7f77b76a6c )