Lingua-FreeLing3
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Lingua/FreeLing3/Word.pm view on Meta::CPAN
our $VERSION = "0.04";
# XXX - Missing
# *add_analysis = *Lingua::FreeLing3::Bindingsc::word_add_analysis;
# *set_analysis = *Lingua::FreeLing3::Bindingsc::word_set_analysis;
# *found_in_dict = *Lingua::FreeLing3::Bindingsc::word_found_in_dict;
# *get_n_selected = *Lingua::FreeLing3::Bindingsc::word_get_n_selected;
# *get_n_unselected = *Lingua::FreeLing3::Bindingsc::word_get_n_unselected;
# *get_n_words_mw = *Lingua::FreeLing3::Bindingsc::word_get_n_words_mw;
# *selected_begin = *Lingua::FreeLing3::Bindingsc::word_selected_begin;
# *selected_end = *Lingua::FreeLing3::Bindingsc::word_selected_end;
# *unselected_begin = *Lingua::FreeLing3::Bindingsc::word_unselected_begin;
# *unselected_end = *Lingua::FreeLing3::Bindingsc::word_unselected_end;
# *get_senses_string = *Lingua::FreeLing3::Bindingsc::word_get_senses_string;
# *get_span_start = *Lingua::FreeLing3::Bindingsc::word_get_span_start;
# *get_span_finish = *Lingua::FreeLing3::Bindingsc::word_get_span_finish;
# *set_found_in_dict = *Lingua::FreeLing3::Bindingsc::word_set_found_in_dict;
# *has_retokenizable = *Lingua::FreeLing3::Bindingsc::word_has_retokenizable;
# *set_span = *Lingua::FreeLing3::Bindingsc::word_set_span;
# *find_tag_match = *Lingua::FreeLing3::Bindingsc::word_find_tag_match;
# *copy_analysis = *Lingua::FreeLing3::Bindingsc::word_copy_analysis;
# *select_analysis = *Lingua::FreeLing3::Bindingsc::word_select_analysis;
# *unselect_analysis = *Lingua::FreeLing3::Bindingsc::word_unselect_analysis;
# *get_n_analysis = *Lingua::FreeLing3::Bindingsc::word_get_n_analysis;
# *unselect_all_analysis = *Lingua::FreeLing3::Bindingsc::word_unselect_all_analysis;
# *select_all_analysis = *Lingua::FreeLing3::Bindingsc::word_select_all_analysis;
# *analysis_begin = *Lingua::FreeLing3::Bindingsc::word_analysis_begin;
# *analysis_end = *Lingua::FreeLing3::Bindingsc::word_analysis_end;
=encoding UTF-8
=head1 NAME
Lingua::FreeLing3::Word - Interface to FreeLing3 Word object
=head1 SYNOPSIS
use Lingua::FreeLing3::Word;
my $empty_word = Lingua::FreeLing3::Word->new;
my $hello_word = Lingua::FreeLing3::Word->new('hello');
=head1 DESCRIPTION
Interface to the FreeLing3 word object.
=head2 C<new>
The C<new> constructor returns a new C<Lingua::FreeLing3::Word>
object. If a parameter is passed, it is interpreted as the word form,
and it is automatically set. Otherwise, an empty word object is
returned.
=cut
sub new {
my $class = shift;
my $word = $class->SUPER::new(@_);
return bless $word => $class #amen
}
sub _new_from_binding {
my ($class, $word) = @_;
return bless $word => $class #amen
}
=head2 C<as_hash>
Returns a reference to a hash with the form, lemma and tag (POS) of
the word.
=cut
sub as_hash {
my $self = shift;
return +{
form => $self->form,
lc_form => $self->lc_form,
lemma => $self->lemma,
tag => $self->tag,
};
}
=head2 C<lemma>
Returns the word C<lemma>, if set. Note that this value can't be set
directly. You can create word analysis, associate them to the word,
and then select the desired analysis (setting up the lemma value).
my $word_lemma = $word->lemma;
=cut
sub lemma {
my $l = $_[0]->SUPER::get_lemma;
utf8::decode($l);
return $l
}
=head2 C<tag>
Returns the word C<tag> (POS), if set. Again, note that this value
can't be set directly. You can create word analysis, associate them to
the word, and then select the desired analysis (setting up the tag
value).
my $word_pos = $word->tag;
=cut
sub tag { $_[0]->SUPER::get_tag }
=head2 C<analysis>
Returns a list of possible analysis. You can pass an extra option
C<FeatureStructure> to obtain the analysis as a list of hashes (list
of feature structures), instead of L<Lingua::FreeLing3::Word::Analysis>
objects.
my $list = $word->analysis(FeatureStructure => 1);
B<TODO:> it is missing the option to add an analysis, or set the full
set at once.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.512 second using v1.00-cache-2.02-grep-82fe00e-cpan-3b7f77b76a6c )