blob: a95605f320893c8e00432c464eb88d65050234c9 [file] [log] [blame]
#!/usr/bin/env perl
use strict;
use warnings;
use KorAP::Def;
use KorAP::DefList;
use lib 'lib';
use Getopt::Long;
# 2020-05-20
# Preliminary support for C2 def-files.
# 2020-05-29
# Introduce optimizable object system.
# 2024-07-17
# Add KorAP::Def.
our $VERSION = 0.2;
our @ARGV;
my $cmd = shift @ARGV;
my $input;
GetOptions (
"input|i=s" => \$input
)
or die("Error in command line arguments\n");
if ($cmd ne 'def' && $cmd ne 'list') {
print <<'HELP';
Convert a list of C2 VC definitions or a single definition into
KoralQuery VCs.
$ perl cosmasvc2koralquery def my_vc.txt | gzip -vc > my_vc.jsonld.gz
$ cat my_vc.txt | perl cosmasvc2koralquery def - | gzip -vc > my_vc.jsonld.gz
Commands: def, list
HELP
exit 1;
};
# Process a list
if ($cmd eq 'list') {
KorAP::DefList->new($input || $ARGV[0])->parse;
exit(0);
};
# Parse a single def
my $def_parser;
if ($ARGV[0] eq '-') {
$def_parser = KorAP::Def->new(\*STDIN);
}
elsif ($input) {
$def_parser = KorAP::Def->new($input);
}
else {
$def_parser = KorAP::Def->new($ARGV[0]);
};
$def_parser->parse;
# Stringify current (extended?) virtual corpus
print $def_parser->to_string;