Lingua::FreeLing3::Word - Interface to FreeLing3 Word object
use Lingua::FreeLing3::Word; my $empty_word = Lingua::FreeLing3::Word->new; my $hello_word = Lingua::FreeLing3::Word->new('hello');
Interface to the FreeLing3 word object.
new
The new constructor returns a new 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.
Lingua::FreeLing3::Word
as_hash
Returns a reference to a hash with the form, lemma and tag (POS) of the word.
lemma
Returns the word 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;
tag
Returns the word 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;
analysis
Returns a list of possible analysis. You can pass an extra option FeatureStructure to obtain the analysis as a list of hashes (list of feature structures), instead of Lingua::FreeLing3::Word::Analysis objects.
FeatureStructure
my $list = $word->analysis(FeatureStructure => 1);
TODO: it is missing the option to add an analysis, or set the full set at once.
form
Set/retrieve word form.
my $word_form = $word->form;
lc_form
Retrieve lowercase word form.
my $lc_form = $word->lc_form;
is_multiword
Returns a true value is the word is a multiword.
get_mw_words
For a multiword word, this method returns an array of its constituent words in array context. In scalar context returns the multiword as a string (words concatenated by a whitespace).
Returns undef if word is not a multiword.
There are a lot of methods to interface with the Word object that are currently not implemented. They should be made available as soon as there is time.
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.