Alvis-NLPPlatform
view release on metacpan or search on metacpan
examples/NLP-standalone view on Meta::CPAN
#!/usr/bin/perl -w -CSD
=head1 NAME
alvis-nlp-standalone - Perl script for linguistically annotating a corpus contained in a file
=head1 SYNOPSIS
alvis-nlp-standalone [options] < Input_document > Annotated_Output_Document
=head1 OPTIONS
=over 4
=item B<--help> brief help message
=item B<--man> full documentation
=item B<--rcfile=file> read the given configuration file
=back
=head1 DESCRIPTION
This script linguistically annotates the document given in the
standard input. The annotated document is sent to the standard
output.
The linguistic annotation depends on the configuration variables and
dependencies between annotation levels.
=head1 SEE ALSO
Alvis web site: http://www.alvis.info
=head1 AUTHORS
Thierry Hamon <thierry.hamon@lipn.univ-paris13.fr> and Julien Deriviere <julien.deriviere@lipn.univ-paris13.fr>
=head1 LICENSE
Copyright (C) 2005 by Thierry Hamon and Julien Deriviere
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or,
at your option, any later version of Perl 5 you may have available.
=cut
use strict;
use Alvis::NLPPlatform;
use Getopt::Long;
use Pod::Usage;
use Config::General;
use Data::Dumper;
use Sys::Hostname;
# Process Option
# my $man = 0;
# my $help = 0;
my $rcfile = "./nlpplatform-test.rc";
# GetOptions('help|?' => \$help, man => \$man, "rcfile=s" => \$rcfile) or pod2usage(2);
# pod2usage(1) if $help;
# pod2usage(-exitstatus => 0, -verbose => 2) if $man;
# if (($rcfile eq "") || (!(-f $rcfile))) {
# pod2usage(1);
# warn "No such config file or config file is not set\n";
# }
my %config = Alvis::NLPPlatform::load_config($rcfile);
my $line;
my $doc_xml = "";
open FILEIN, "./InputDocument.xml" or die "./InputDocument.xml: No such file (maybe you are not in the example directory\n";
while($line=<FILEIN>) {
$doc_xml .= $line;
}
close FILEIN;
# my @tab_docs_xml = Alvis::NLPPlatform::split_to_docRecs($doc_xml);
print STDERR "The annotated document is stored in the file ./OutputDocument.xml\n";
open FILEOUT, "> ./OutputDocument.xml";
# Alvis::NLPPlatform::Annotation::print_documentCollectionHeader(\*FILEOUT);
my $i;
my $render_time;
my @cur_doc;
my $j;
my $tmpfile;
my $HOSTNAME=hostname;
# for($i = 0; $i<scalar(@tab_docs_xml); $i++) {
print FILEOUT Alvis::NLPPlatform::standalone(\%config, $HOSTNAME, $doc_xml);
# }
# Alvis::NLPPlatform::Annotation::print_documentCollectionFooter(\*FILEOUT);
close FILEOUT;
( run in 0.520 second using v1.01-cache-2.11-cpan-f56aa216473 )