FL3 - A shortcut module for Lingua::FreeLing3.
use FL3 'en'; # This is the usual workflow: # 1. tokenize your text $tokens = tokenizer->tokenize($text); $atomos = tokenizer('pt')->tokenize($texto); # 2. divide tokens in groups: sentences $sentences = splitter->split($tokens); $frases = splitter('pt')->split($atomos); # 3. use a morphologic analyzer to tag words $sentences = morph->analyze($sentences); $frases = morph('pt')->analyze($frases); # 4. use HMM or RELAX tagger to disambiguate $sentences = hmm->analyze($sentences); $frases = relax('pt')->tag($sentences); # 5. use chart parser to parse tree $sentences = chart->parse($sentences); $ptree = $sentences->[0]->parse_tree; # other utility methods $word = word("cavalo"); @words = word("cavalo", "alado"); $sentence = sentence(word(qw(gosto muito de ti)));
Implements a set of utility functions to access Lingua::FreeLing3 objects.
Lingua::FreeLing3
Everytime one of the accessors is used just with the language code/language data file (or using the default language), the cached processor is returned if it exists. If any other arguments are used, a new processor is created. This means that if you want to use the morphological analyzer more than once, with different arguments, you should first initialize it, using:
morph( en => (AffixFile => 'myAfixes.dat', DictionaryFile => 'myFile.src'));
And then, when analyzing sentences, use:
morph('en')->analyze($sentences);
This way, the processor initialized before will be used without reinitialziation.
set_language
Sets the current language for subsequent methods calls. Returns the old set language, if any.
release_language
Some resources take too much space on memory. Use this method to release the resources for a specific language. If you need them again, they will be recreated.
Only one argument is mandatory: the name of the language. Unlike the other method, this method requires that you supply the language name. It does not use the default language.
Extra arguments are the name of the modules to be released (same names as their accessor methods).
tokenizer
Accesses a tokenizer (Lingua::FreeLing3::Tokenizer).
splitter
Accesses a splitter (Lingua::FreeLing3::Splitter).
morph
Accesses a morphological analyzer (Lingua::FreeLing3::MorphAnalyzer).
hmm
Accesses a HMM-based tagger (Lingua::FreeLing3::HMMTagger).
relax
Accesses a Relax-based tagger (Lingua::FreeLing3::RelaxTagger).
chart
Accesses a Chart-based parser (Lingua::FreeLing3::ChartParser).
txala
Accesses a Txala-based dependency parser (Lingua::FreeLing3::DepTxala).
nec
Accesses a Name Entity parser (Lingua::FreeLing3::NEC).
word
Lingua::FreeLing3::Word object constructor shortcut.
Lingua::FreeLing3::Word
sentence
Lingua::FreeLing3::Sentence object constructor shortcut.
Lingua::FreeLing3::Sentence
Lingua::FreeLing3(3)
Alberto Simões, <ambs@cpan.org>
Copyright (C) 2012 by Alberto Simões
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.