Alvis-NLPPlatform
view release on metacpan or search on metacpan
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
use IO::Socket;
use Sys::Hostname;
use XML::LibXML;
use IO::Socket;
use IO::Socket::INET;
use Fcntl qw(:DEFAULT :flock :seek);
use Alvis::Pipeline;
use File::Path qw(mkpath);
use File::Touch;
#use Data::Dumper;
my $cur_doc_nb;
my $done_parsing;
our $last_doc;
our @tab_end_sections_byaddr;
our @tab_end_sections_bytoken;
our %hash_tokens;
our %hash_words;
our %hash_words_punct;
#our %hash_words_punct2words;
our %hash_sentences;
our %hash_postags;
our %hash_named_entities;
our %hash_lemmas;
our $number_of_words;
our $number_of_sentences;
our $nb_relations;
our $dont_annotate;
our @word_start;
our @word_end;
our @en_start;
our @en_end;
our @en_type;
our @en_tokens_start;
our @en_tokens_end;
our %en_tokens_hash;
our $last_semantic_unit;
our $last_semantic_feature;
our %last_words;
our @found_terms;
our @found_terms_tidx;
our @found_terms_smidx;
our @found_terms_phr;
our @found_terms_words;
my $phrase_idx;
my $id;
# Timer
my $timer_mem;
# because those variables have to be viewed in the sigint handler !!!
my $nlp_host;
my $nlp_port;
my $connection_retry;
# ENVIRONMENT VARIABLES
my $NLPTOOLS;
my $ALVISTMP;
our $ALVISLOGFILE;
my $HOSTNAME;
my $TMPFILE;
my $ALVISRSC;
our $ALVISDEBUG = 0;
my $ENABLE_TOKEN;
my $ENABLE_NER;
my $ENABLE_WORD;
my $ENABLE_SENTENCE;
my $ENABLE_POS;
my $ENABLE_LEMMA;
my $ENABLE_TERM_TAG;
my $ENABLE_SYNTAX;
my $ENABLE_SEMANTIC_TAG;
# Dependencies mask
my $MASK_TOKEN=1;
my $MASK_NER=2;
my $MASK_WORD=4;
my $MASK_SENTENCE=8;
my $MASK_POS=16;
my $MASK_LEMMA=32;
my $MASK_TERM_TAG=64;
my $MASK_SYNTAX=128;
my $MASK_SEMANTIC_TAG=256;
# LOG MANAGEMENT
our @tab_errors;
my $log_entry;
# BENCHMARKING
my $time_load = 0;
my $time_tok = 0;
my $time_ne = 0;
my $time_word = 0;
my $time_sent = 0;
my $time_pos = 0;
my $time_lemm = 0;
my $time_term = 0;
my $time_synt = 0;
my $time_semtag = 0;
my $time_render = 0;
my $time_total = 0;
sub compute_dependencies{
my $h_config = $_[0];
my $val=0;
if($h_config->{'linguistic_annotation'}->{'ENABLE_TOKEN'}){
$val|=1;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_NER'}){
$val|=3;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_WORD'}){
$val|=5;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_SENTENCE'}){
$val|=13;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_POS'}){
$val|=29;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_LEMMA'}){
$val|=61;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_TERM_TAG'}){
$val|=77;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_SYNTAX'}){
$val|=157;
}
if($h_config->{'linguistic_annotation'}->{'ENABLE_SEMANTIC_TAG'}){
$val|=511;
}
print STDERR "Dependency mask: $val\n";
if($val&$MASK_TOKEN){$ENABLE_TOKEN=1;}else{$ENABLE_TOKEN=0;}
if($val&$MASK_NER){$ENABLE_NER=1;}else{$ENABLE_NER=0;}
if($val&$MASK_WORD){$ENABLE_WORD=1;}else{$ENABLE_WORD=0;}
if($val&$MASK_SENTENCE){$ENABLE_SENTENCE=1;}else{$ENABLE_SENTENCE=0;}
if($val&$MASK_POS){$ENABLE_POS=1;}else{$ENABLE_POS=0;}
if($val&$MASK_LEMMA){$ENABLE_LEMMA=1;}else{$ENABLE_LEMMA=0;}
if($val&$MASK_TERM_TAG){$ENABLE_TERM_TAG=1;}else{$ENABLE_TERM_TAG=0;}
if($val&$MASK_SYNTAX){$ENABLE_SYNTAX=1;}else{$ENABLE_SYNTAX=0;}
if($val&$MASK_SEMANTIC_TAG){$ENABLE_SEMANTIC_TAG=1;}else{$ENABLE_SEMANTIC_TAG=0;}
print STDERR "TOKENS: "; if($ENABLE_TOKEN){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "NER: "; if($ENABLE_NER){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "WORDS: "; if($ENABLE_WORD){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "SENTENCES: "; if($ENABLE_SENTENCE){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "POS: "; if($ENABLE_POS){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "LEMMA: "; if($ENABLE_LEMMA){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "TERM_TAGGING: "; if($ENABLE_TERM_TAG){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "SYNTAX: "; if($ENABLE_SYNTAX){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
print STDERR "SEMANTIC TAGGING: "; if($ENABLE_SEMANTIC_TAG){print STDERR "Enabled\n";}else{print STDERR "Disabled\n";}
return;
}
###########################################################################
sub starttimer(){
my $sec;
my $usec;
($sec,$usec)=gettimeofday();
$usec/=1000000;
$timer_mem=($sec+$usec);
}
sub endtimer(){
my $sec;
my $usec;
($sec,$usec)=gettimeofday();
$usec/=1000000;
return (($sec+$usec)-$timer_mem);
}
sub linguistic_annotation {
my $h_config = $_[0];
my $doc_hash = $_[1];
my $nb_max_tokens = 0;
$Alvis::NLPPlatform::Annotation::phrase_idx = 1;
$Alvis::NLPPlatform::Annotation::syntactic_relation_idx = 1;
print STDERR "Working Language: " . $Alvis::NLPPlatform::Annotation::ALVISLANGUAGE . "\n";
starttimer();
if ($ENABLE_TOKEN) {
# Tokenize
Alvis::NLPPlatform::UserNLPWrappers->tokenize($h_config,$doc_hash);
# print STDERR $Alvis::NLPPlatform::Annotation::nb_max_tokens. "\n";
$time_tok+=endtimer();
print STDERR "\tTokenization Time : $time_tok\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Tokenization Time : $time_tok";
if ($Alvis::NLPPlatform::Annotation::nb_max_tokens >0) {
# Scan for NE
if($ENABLE_NER==1){
starttimer();
Alvis::NLPPlatform::UserNLPWrappers->scan_ne($h_config, $doc_hash);
$time_ne+=endtimer();
print STDERR "\tNamed Entity Recognition Time : $time_ne\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Named Entity Recognition Time : $time_ne";
}
# Word segmentation
if($ENABLE_WORD==1){
starttimer();
Alvis::NLPPlatform::UserNLPWrappers->word_segmentation($h_config, $doc_hash);
$time_word+=endtimer();
print STDERR "\tWord Segmentation Time : $time_word\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Word Segmentation Time : $time_word";
}
if($dont_annotate==1){
print STDERR "Skipped document\n";
undef %$doc_hash;
%$doc_hash=();
$doc_hash=0;
push @tab_errors,"SKIPPED DOCUMENT\n";
push @tab_errors,"URL: ".$Alvis::NLPPlatform::Annotation::documenturl."\n";
push @tab_errors,"Language tag: ".$Alvis::NLPPlatform::Annotation::ALVISLANGUAGE."\n";
push @tab_errors,"Temporary files can be found with the following prefix: $TMPFILE\n";
}
# Sentence segmentation
if($ENABLE_SENTENCE==1){
starttimer();
if(!$dont_annotate){Alvis::NLPPlatform::UserNLPWrappers->sentence_segmentation($h_config, $doc_hash)};
$time_sent+=endtimer();
print STDERR "\tSentence Segmentation Time : $time_sent\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Sentence Segmentation Time : $time_sent";
}
# PoS tagging / Lemmatization
if($ENABLE_POS==1){
starttimer();
if(!$dont_annotate){Alvis::NLPPlatform::UserNLPWrappers->pos_tag($h_config, $doc_hash)};
$time_pos+=endtimer();
print STDERR "\tPart of Speech Tagging Time : $time_pos\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Part of Speech Tagging Time : $time_pos";
}
# Term tagging
if($ENABLE_TERM_TAG==1){
starttimer();
if(!$dont_annotate){Alvis::NLPPlatform::UserNLPWrappers->term_tag($h_config, $doc_hash)};
$time_term+=endtimer();
print STDERR "\tTerm Tagging Time : $time_term\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Term Tagging Time : $time_term";
}
# Syntactic parsing
if($ENABLE_SYNTAX==1){
starttimer();
if(!$dont_annotate){Alvis::NLPPlatform::UserNLPWrappers->syntactic_parsing($h_config, $doc_hash)};
$time_synt+=endtimer();
print STDERR "\tSyntactic Parsing Time : $time_synt\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Syntactic Parsing Time : $time_synt";
}
# Semantic tagging
if($ENABLE_SEMANTIC_TAG==1){
starttimer();
if(!$dont_annotate){Alvis::NLPPlatform::UserNLPWrappers->semantic_feature_tagging($h_config, $doc_hash)};
$time_semtag+=endtimer();
print STDERR "\tSemantic Feature Tagging Time : $time_semtag\n";
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "Semantic Feature Tagging Time : $time_semtag";
}
}
}
}
###########################################################################
###########################################################################
sub platform_reset {
# %$doc_hash = ();
@Alvis::NLPPlatform::tab_end_sections_byaddr = ();
@Alvis::NLPPlatform::tab_end_sections_bytoken = ();
%Alvis::NLPPlatform::hash_tokens = ();
%Alvis::NLPPlatform::hash_words = ();
%Alvis::NLPPlatform::hash_words_punct = ();
%Alvis::NLPPlatform::hash_sentences = ();
%Alvis::NLPPlatform::hash_postags = ();
%Alvis::NLPPlatform::hash_named_entities = ();
%Alvis::NLPPlatform::hash_lemmas = ();
$Alvis::NLPPlatform::number_of_words = 0;
$Alvis::NLPPlatform::number_of_sentences = 0;
$Alvis::NLPPlatform::nb_relations = 0;
$Alvis::NLPPlatform::dont_annotate = 0;
@Alvis::NLPPlatform::word_start = ();
@Alvis::NLPPlatform::word_end = ();
@Alvis::NLPPlatform::en_start = ();
@Alvis::NLPPlatform::en_end = ();
@Alvis::NLPPlatform::en_type = ();
@Alvis::NLPPlatform::en_tokens_start = ();
@Alvis::NLPPlatform::en_tokens_end = ();
%Alvis::NLPPlatform::en_tokens_hash = ();
$Alvis::NLPPlatform::last_semantic_unit = 0;
$Alvis::NLPPlatform::last_semantic_feature = 0;
%Alvis::NLPPlatform::last_words = ();
@Alvis::NLPPlatform::found_terms = ();
@Alvis::NLPPlatform::found_terms_tidx = ();
@Alvis::NLPPlatform::found_terms_smidx = ();
@Alvis::NLPPlatform::found_terms_phr = ();
@Alvis::NLPPlatform::found_terms_words = ();
$Alvis::NLPPlatform::phrase_idx = 1;
return(0);
}
###########################################################################
###########################################################################
###########################################################################
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
$last_semantic_unit=0;
$last_semantic_feature = 0;
$cur_doc_nb=1;
compute_dependencies($h_config);
$NLPTOOLS=$h_config->{'NLP_tools_root'};
$ALVISTMP=$h_config->{'ALVISTMP'};
$HOSTNAME=hostname
$ALVISRSC=$h_config->{'NLP_misc'}->{'NLP_resources'};
if (!exists $h_config->{'TMPFILE'}) {
$h_config->{'TMPFILE'}="$ALVISTMP/$HOSTNAME.$$";
}
$ALVISLOGFILE= "$ALVISTMP/alvis.$HOSTNAME.$$.log";
if (exists $h_config->{'DEBUG'}) {
$ALVISDEBUG = $h_config->{'DEBUG'};
}
print STDERR "\n";
$time_load=0;
$time_tok=0;
$time_ne=0;
$time_word=0;
$time_sent=0;
$time_pos=0;
$time_lemm=0;
$time_term=0;
$time_render=0;
# Load document record
print STDERR "Loading DR... ";
undef %$doc_hash;
%$doc_hash=();
$doc_hash=0;
%hash_tokens=();
$dont_annotate=0;
%hash_words=();
%hash_words_punct=();
%hash_sentences=();
%hash_postags=();
@word_start=();
@word_end=();
%last_words=();
@found_terms=();
@found_terms_tidx=();
@found_terms_smidx=();
@found_terms_phr=();
@found_terms_words=();
$phrase_idx=1;
@tab_errors=();
starttimer();
# $doc_xml =~ s/("<\?xml version=\"1.0\" encoding=\"$charset\"?>\n
$doc_hash=Alvis::NLPPlatform::Annotation::load_xml($doc_xml, $h_config);
$time_load+=endtimer();
# Recording computing data (time and entity size)
# init
$doc_hash->{"log_processing0"}->{"datatype"}="log_processing";
$doc_hash->{"log_processing0"}->{"log_id"} = "time";
$doc_hash->{"log_processing1"}->{"datatype"}="log_processing";
$doc_hash->{"log_processing1"}->{"log_id"} = "element_size";
$doc_hash->{"log_processing2"}->{"datatype"}="log_processing";
$doc_hash->{"log_processing2"}->{"log_id"} = "host";
$doc_hash->{"log_processing2"}->{"comments"} = $HOSTNAME;
# Recording statistical data (time and entity size)
# XML loading time
my @tmp_c;
$doc_hash->{"log_processing0"}->{"comments"} = \@tmp_c;
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "XML loading Time : $time_load";
print STDERR "\tXML loading Time : $time_load\n";
my @tmp_d;
$doc_hash->{"log_processing1"}->{"comments"} = \@tmp_d;
if($doc_hash!=0)
{
print STDERR "done - documentRecord ".$Alvis::NLPPlatform::Annotation::document_record_id;
print STDERR " (document $cur_doc_nb)\n";
Alvis::NLPPlatform::linguistic_annotation($h_config, $doc_hash);
# Save to XML file
$cur_doc_nb++;
print STDERR "Rendering XML... ";
starttimer();
$time_render = 0;
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "XML rendering Time : \@RENDER_TIME_NOT_SET\@";
Alvis::NLPPlatform::Annotation::render_xml($doc_hash, $descriptor, $printCollectionHeaderFooter, $h_config);
$time_render+=endtimer();
# TODO : recording the xml rendering time
# Recording statistical data (time and entity size)
# XML rendering (unsuable)
print STDERR "done\n";
print STDERR "\tXML rendering Time : $time_render\n";
}else{
print STDERR "done parsing - no more documents.\n";
last;
}
print STDERR "\n";
# log errors
open LOGERRORS,">>$ALVISLOGFILE";
if(scalar @tab_errors>0){
print LOGERRORS "Document $Alvis::NLPPlatform::Annotation::document_record_id (number $cur_doc_nb)\n";
foreach $log_entry(@tab_errors){
print LOGERRORS "$log_entry";
}
}
# }
close LOGERRORS;
# $time_total=$time_load+$time_tok+$time_ne+$time_word+$time_sent+$time_pos+$time_lemm+$time_term+$time_render;
return($time_render);
}
sub client_main {
my $doc_hash = $_[0];
my $r_config = $_[1];
$last_semantic_unit=0;
$last_semantic_feature = 0;
$cur_doc_nb=1;
compute_dependencies($r_config);
$NLPTOOLS=$r_config->{'NLP_tools_root'};
$ALVISTMP=$r_config->{'ALVISTMP'};
$HOSTNAME=hostname
$ALVISRSC=$r_config->{'NLP_misc'}->{'NLP_resources'};
if (!exists $r_config->{'TMPFILE'}) {
$r_config->{'TMPFILE'}="$ALVISTMP/$HOSTNAME.$$";
}
print STDERR "\n";
$ALVISLOGFILE= "$ALVISTMP/alvis.$HOSTNAME.$$.log";
# $ALVISLOGFILE=$r_config->{'TMPFILE'} . ".log";
if (exists $r_config->{'DEBUG'}) {
$ALVISDEBUG = $r_config->{'DEBUG'};
}
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
print STDERR "Receiving document...\n";
# SENDING $id
while($line = <$sock>) {
print STDERR "$line";
$line=uc $line;
if ($line =~ /SENDING ([^\n]+)\n/) {
$id = $1;
last;
} else {
warn "Out of protocol message\n";
close $sock;
next;
}
}
print STDERR "GETTING $id\n";
# SIZE of $doc_xml
while ($line = <$sock>) {
print STDERR "$line";
$line=uc $line;
if ($line =~ /SIZE ([^\n]+)\n/) {
$doc_xml_size = $1;
last;
} else {
warn "Out of protocol message\n";
close $sock;
next;
}
}
print STDERR "READING $doc_xml_size bytes\n";
$doc_xml = "";
print STDERR length($doc_xml) . "\r";
while ((defined $sock) && ($line = <$sock>) && ($line ne "<DONE>\n")) { # (length($doc_xml) < $doc_xml_size) &&
print STDERR length($doc_xml) . "\r";
$doc_xml .= $line;
}
if (length($doc_xml) > $doc_xml_size) {
warn "Received more bytes than expected\n";
}
print STDERR length($doc_xml) . "\n";
print STDERR "\n";
print STDERR "READING $id done.\n";
print STDERR "Sending ACK...";
print $sock "ACK\n";
print STDERR "done.\n";
close $sock;
# restore the normal behaviour
$SIG{'INT'} = \&sigint_handler;
print STDERR "Processing $id";
my $doc_hash;
Alvis::NLPPlatform::starttimer();
$doc_hash=Alvis::NLPPlatform::Annotation::load_xml($doc_xml, \%config);
my $time_load+=Alvis::NLPPlatform::endtimer();
# Recording computing data (time and entity size)
# init
# $doc_hash->{"log_processing"} = {};
$doc_hash->{"log_processing0"}->{"datatype"}="log_processing";
$doc_hash->{"log_processing0"}->{"log_id"} = "time";
$doc_hash->{"log_processing1"}->{"datatype"}="log_processing";
$doc_hash->{"log_processing1"}->{"log_id"} = "element_size";
# Recording statistical data (time and entity size)
# XML loading time
my @tmp_c;;
$doc_hash->{"log_processing0"}->{"comments"} = \@tmp_c;
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "XML loading Time : $time_load";
my @tmp_d;;
$doc_hash->{"log_processing1"}->{"comments"} = \@tmp_d;
$doc_hash = Alvis::NLPPlatform::client_main($doc_hash, \%config);
# to not stop the connection (should crash the server)
$sig_handler = $SIG{'INT'};
$SIG{'INT'}='IGNORE'; # to prevent zombification
$connection_retry=$config{"alvis_connection"}->{"RETRY_CONNECTION"};
do {
$sock=new IO::Socket::INET( PeerAddr => $nlp_host,
PeerPort => $nlp_port,
Proto => 'tcp');
warn "Could not create socket: $! \n" unless $sock;
$connection_retry--;
sleep(1);
} while(!defined($sock) && ($connection_retry >0));
if ($connection_retry ==0) {
die "Timeout. Could not create socket: $! \n";
}
binmode $sock, ":utf8";
print STDERR "Established connection to server.\n";
print STDERR "Giving back annotated document...\n";
# Communitation with the server
print $sock "GIVEBACK\n$id\n";
# Save to XML file
print STDERR "\tRendering XML... ";
starttimer();
$time_render = 0;
push @{$doc_hash->{"log_processing0"}->{"comments"}}, "XML rendering Time : \@RENDER_TIME_NOT_SET\@";
Alvis::NLPPlatform::Annotation::render_xml($doc_hash, $sock, 1,\%config);
$time_render+=endtimer();
# TODO : recording the xml rendering time
print STDERR "done\n";
print $sock "<DONE>\n";
print STDERR "done.\n";
# the render time is sent
print $sock "RENDER TIME\n$time_render\n";
print STDERR "Awaiting acknowledgement...";
my $line;
while($line=<$sock>){
chomp $line;
$line=uc $line;
if($line=~/ACK/gi){
close($sock);
last;
} }
print STDERR "OK.\n";
close($sock);
# restore the normal behaviour
$SIG{'INT'} = $sig_handler;
print STDERR "Closed connection to server.\n";
}
return($time_render);
}
sub sigint_handler {
my ($signal) = @_;
my $sock;
# $nlp_host = $r_config->{"NLP_connection"}->{"SERVER"};
# $nlp_port = $r_config->{"NLP_connection"}->{"PORT"};
warn "Receiving SIGINT -- Aborting NL processing\n";
do {
$sock=new IO::Socket::INET( PeerAddr => $nlp_host,
PeerPort => $nlp_port,
Proto => 'tcp');
warn "Could not create socket: $! \n" unless $sock;
$connection_retry--;
sleep(1);
} while(!defined($sock) && ($connection_retry >0));
if ($connection_retry ==0) {
die "Timeout. Could not create socket: $! \n";
}
$sock -> autoflush(1); ###############
lib/Alvis/NLPPlatform.pm view on Meta::CPAN
=item 3
Word segmentation: this step requires tokenization.
The Named Entity Tagging step is recommended to improve the segmentation.
=item 4
Sentence segmentation: this step requires tokenization.
The Named Entity Tagging step is recommended to improve the segmentation.
=item 5
Part-Of-Speech Tagging: this step requires tokenization, and word and
sentence segmentation.
=item 6
Lemmatization: this step requires tokenization,
word and sentence segmentation, and Part-of-Speech tagging.
=item 7
Term Tagging: this step requires tokenization,
word and sentence segmentation, and Part-of-Speech tagging. Lemmatization is recommended to improve the term recognition.
=item 8
Parsing: this step requires tokenization, word and sentence
segmentation. Term tagging is recommended to improve the parsing of noun phrases.
=item 9
Semantic feature tagging: To be determined
=item 10
Semantic relation tagging: To be determined
=item 11
Anaphora resolution: To be determined
=back
=head1 METHODS
=head2 compute_dependencies()
compute_dependencies($hashtable_config);
This method processes the configuration variables defining the
linguistic annotation steps. C<$hash_config> is the
reference to the hashtable containing the variables defined in the
configuration file. The dependencies of the linguistic
annotations are then coded. For instance, asking for POS annotation will
imply tokenization, word and sentence segmentations.
=head2 starttimer()
starttimer()
This method records the current date and time. It is used to compute
the time of a processing step.
=head2 endtimer()
endtimer();
This method ends the timer and returns the time of a processing step, according to the time recorded by C<starttimer()>.
=head2 linguistic_annotation()
linguistic_annotation($h_config,$doc_hash);
This methods carries out the lingsuitic annotation according to the list
of required annotations. Required annotations are defined by the
configuration variables (C<$hash_config> is the
reference to the hashtable containing the variables defined in the
configuration file).
The document to annotate is passed as a hash table (C<$doc_hash>). The
method adds annotation to this hash table.
=head2 standalone()
standalone($config, $HOSTNAME, $doc);
This method is used to annotate a document in the standalone mode of
the platform. The document C<$doc> is given in
the ALVIS XML format.
The reference to the hashtable C<$config> contains the configuration
variables. The variable C<$HOSTNAME> is the host name.
The method returns the annotation document.
=head2 standalone_main()
standalone_main($hash_config, $doc_xml, \*STDOUT);
This method is used to annotate a document in the standalone mode of
the platform. The document (C<%doc_xml>) is given in the ALVIS XML
format.
The document is loaded into memory and then annotated according to the
steps defined in the configuration variables (C<$hash_config> is the
reference to the hashtable containing the variables defined in the
configuration file). The annotated document is printed to the file
defined by the descriptor given as parameter (in the given example,
the standard output). C<$printCollectionHeaderFooter> indicates if the
C<documentCollection> header and footer have to be printed.
The function returns the time of the XML rendering.
=head2 client_main()
client_main($doc_hash, $r_config);
This method is used to annotate a document in the distributed mode of
the NLP platform. The document given in the ALVIS XML
format is already is loaded into memory (C<$doc_hash>).
( run in 1.007 second using v1.01-cache-2.11-cpan-bbcb1afb8fc )