Alvis-NLPPlatform

 view release on metacpan or  search on metacpan

bin/ogmios-nlp-server  view on Meta::CPAN

#!/usr/bin/perl -w

use strict;
use warnings;
# use Alvis::Pipeline;
# use XML::LibXML;
# use IO::Socket;
# use IO::File;
# use IO::Socket::INET;
# use Fcntl qw(:flock);

use Alvis::Convert;

use Alvis::NLPPlatform;
use Alvis::NLPPlatform::Convert;

use Getopt::Long;
use Pod::Usage;
use Config::General;
use Data::Dumper;

# Process Option

my $man = 0;
my $help = 0;
my $rcfile = "";

my $current_dir;
my $dirfile;
my $file;


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 $mm = Alvis::NLPPlatform::Convert::load_MagicNumber(\%config);

my $AlvisConverter = Alvis::NLPPlatform::Convert::html2alvis_init(\%config);

foreach $file (@ARGV) {
    if (-f $file) {
	print STDERR "Converting the file $file ... ";
	# Insure that Input files will be stored
	$config{"CONVERTERS"}->{"StoreInputFiles"} = 1;
	Alvis::NLPPlatform::Convert::conversion_file_to_alvis_xml($file, $AlvisConverter, \%config, $mm);
	print STDERR "done\n";
    } else { 
	if (-d $file) {
	    $current_dir = $file;
	    opendir DIR, $file;
	    while ($dirfile = readdir DIR) {
		if (($dirfile ne ".") && ($dirfile ne "..")) {
		    push @ARGV, "$current_dir/$dirfile";
		}
	    }
	    closedir DIR;
	}
    }
}



Alvis::NLPPlatform::Convert::making_spool(\%config, $AlvisConverter->{"outputRootDir"});

Alvis::NLPPlatform::server($rcfile);


__END__

=head1 NAME



( run in 0.952 second using v1.01-cache-2.11-cpan-fe3c2283af0 )