1) dgp nie wysypuje sie na nieznanych kategoriach
2) dodane i uzupelnione konfigi git-svn-id: svn://atos.wmid.amu.edu.pl/utt@49 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
This commit is contained in:
parent
9b57c4d68c
commit
3748bd1db4
@ -12,3 +12,4 @@
|
|||||||
#
|
#
|
||||||
categories = PATH_PREFIX/share/utt/cats.dgc
|
categories = PATH_PREFIX/share/utt/cats.dgc
|
||||||
grammar = PATH_PREFIX/share/utt/gram.dgc
|
grammar = PATH_PREFIX/share/utt/gram.dgc
|
||||||
|
outputfile = PATH_PREFIX/share/utt/gram.dgp
|
||||||
|
18
app/conf/dgp.conf
Normal file
18
app/conf/dgp.conf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# ************************************************************
|
||||||
|
# * This file was created automatically during installation. *
|
||||||
|
# * If you don't need do not change it. *
|
||||||
|
# * *
|
||||||
|
# * UAM Text Tools *
|
||||||
|
# * Adam Mickiewicz University, Poland *
|
||||||
|
# * http://utt.amu.edu.pl *
|
||||||
|
# ************************************************************
|
||||||
|
#
|
||||||
|
# All lines must looks like:
|
||||||
|
# parameter_name [=] value
|
||||||
|
#
|
||||||
|
|
||||||
|
grammar = PATH_PREFIX/share/utt/gram.dgp
|
||||||
|
process = W
|
||||||
|
process = BOS
|
||||||
|
process = EOS
|
||||||
|
info = d
|
16
app/conf/gph.conf
Normal file
16
app/conf/gph.conf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# ************************************************************
|
||||||
|
# * This file was created automatically during installation. *
|
||||||
|
# * If you don't need do not change it. *
|
||||||
|
# * *
|
||||||
|
# * UAM Text Tools *
|
||||||
|
# * Adam Mickiewicz University, Poland *
|
||||||
|
# * http://utt.amu.edu.pl *
|
||||||
|
# ************************************************************
|
||||||
|
#
|
||||||
|
# All lines must looks like:
|
||||||
|
# parameter_name [=] value
|
||||||
|
#
|
||||||
|
process = W
|
||||||
|
process = BOS
|
||||||
|
process = EOS
|
||||||
|
reset = BOS
|
@ -2,7 +2,7 @@ package "dgp"
|
|||||||
version "0.1"
|
version "0.1"
|
||||||
|
|
||||||
option "grammar" g "Grammar file"
|
option "grammar" g "Grammar file"
|
||||||
string typestr="filename" default="dgp.dgp"
|
string no typestr="filename"
|
||||||
|
|
||||||
option "long" l "Long output"
|
option "long" l "Long output"
|
||||||
flag off
|
flag off
|
||||||
|
@ -37,13 +37,13 @@ foreach $file ($systemconfigfile, $userconfigfile){
|
|||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
next unless length;
|
next unless length;
|
||||||
my ($name, $value) = split(/\s*=\s*/, $_, 2);
|
my ($name, $value) = split(/\s*=\s*/, $_, 2);
|
||||||
if(($name eq "catfile")or($name eq "c")){
|
if(($name eq "categories")or($name eq "c")){
|
||||||
$catfile=$value;
|
$catfile=$value;
|
||||||
}
|
}
|
||||||
elsif(($name eq "dicfile")or($name eq "d")){
|
elsif(($name eq "dictionary")or($name eq "d")){
|
||||||
$dicfile=$value;
|
$dicfile=$value;
|
||||||
}
|
}
|
||||||
elsif(($name eq "gramfile")or($name eq "g")){
|
elsif(($name eq "grammar")or($name eq "g")){
|
||||||
$gramfile=$value;
|
$gramfile=$value;
|
||||||
}
|
}
|
||||||
elsif(($name eq "outputfile")or($name eq "o")){
|
elsif(($name eq "outputfile")or($name eq "o")){
|
||||||
@ -60,21 +60,28 @@ foreach $file ($systemconfigfile, $userconfigfile){
|
|||||||
#########################################################
|
#########################################################
|
||||||
|
|
||||||
GetOptions("help|h" => \$help,
|
GetOptions("help|h" => \$help,
|
||||||
"catfile|c=s" => \$catfile,
|
"categories|c=s" => \$catfile,
|
||||||
"dicfile|d=s" => \$dicfile,
|
"dictionary|d=s" => \$dicfile,
|
||||||
"gramfile|g=s" => \$gramfile,
|
"grammar|g=s" => \$gramfile,
|
||||||
"outputfile|o=s" => \$outputfile);
|
"outputfile|o=s" => \$outputfile);
|
||||||
|
|
||||||
|
my $homedir = $ENV{'HOME'};
|
||||||
|
$catfile =~ s/~/$homedir/;
|
||||||
|
$dicfile =~ s/~/$homedir/;
|
||||||
|
$gramfile =~ s/~/$homedir/;
|
||||||
|
$outputfile =~ s/~/$homedir/;
|
||||||
|
|
||||||
|
|
||||||
if($help)
|
if($help)
|
||||||
{
|
{
|
||||||
print <<'END'
|
print <<'END'
|
||||||
Usage: dgc [OPTIONS]
|
Usage: dgc [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--catfile -c filename List of syntactic categories.
|
--categories -c filename List of syntactic categories.
|
||||||
--dicfile -d filename Dictionary.
|
--dictionary -d filename Dictionary.
|
||||||
--gramfile -g filename List of grammar rules.
|
--grammar -g filename List of grammar rules.
|
||||||
--outputfile -o filename Output filename.
|
--outputfile -o filename Output file name.
|
||||||
--help -h Help.
|
--help -h Help.
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
|
@ -17,7 +17,7 @@ class Grammar
|
|||||||
|
|
||||||
// enum CONSTR { SGL, OBL, LEFT, RIGHT, INIT, NONINIT, FIN, NONFIN };
|
// enum CONSTR { SGL, OBL, LEFT, RIGHT, INIT, NONINIT, FIN, NONFIN };
|
||||||
|
|
||||||
Grammar() : types_sz(0), cats_sz(0) { } ;
|
Grammar() : types_sz(0), cats_sz(0) {} ;
|
||||||
|
|
||||||
int types_sz;
|
int types_sz;
|
||||||
int cats_sz;
|
int cats_sz;
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
char segment[MAXSEGMENTS][MAXLINE];
|
char segment[MAXSEGMENTS][MAXLINE];
|
||||||
int segcount=0;
|
int segcount=0;
|
||||||
char seg_mnode[MAXSEGMENTS];
|
char seg_mnode[MAXSEGMENTS];
|
||||||
|
char grammarfile[255];
|
||||||
|
|
||||||
|
|
||||||
Grammar grammar;
|
Grammar grammar;
|
||||||
MGraph mgraph;
|
MGraph mgraph;
|
||||||
@ -40,18 +42,13 @@ main(int argc, char* argv[])
|
|||||||
process_config_files(&args,argv[0]);
|
process_config_files(&args,argv[0]);
|
||||||
process_common_options(&args,argv[0]);
|
process_common_options(&args,argv[0]);
|
||||||
|
|
||||||
// if(args.help_given) cmdline_parser_print_help ();
|
if(!args.grammar_given)
|
||||||
|
fprintf(stderr,"dgp: no grammar given\n");
|
||||||
|
|
||||||
// if(args.input_given)
|
expand_path(args.grammar_arg,grammarfile);
|
||||||
// if(!(inputf=fopen(args.input_arg,"r")))
|
|
||||||
// fprintf(stderr,"dgp: input file not found: %s.\n", args.input_arg), exit(1);
|
|
||||||
|
|
||||||
// if(args.output_given)
|
if(!(grammarf=fopen(grammarfile,"r")))
|
||||||
// if(!(outputf=fopen(args.output_arg,"w")))
|
fprintf(stderr,"dgp: grammar file not found: %s.\n", grammarfile), exit(1);
|
||||||
// fprintf(stderr,"dgp: cannot open output file: %s.\n", args.output_arg), exit(1);
|
|
||||||
|
|
||||||
if(!(grammarf=fopen(args.grammar_arg,"r")))
|
|
||||||
fprintf(stderr,"dgp: grammar file not found: %s.\n", args.grammar_arg), exit(1);
|
|
||||||
|
|
||||||
if(args.debug_given) debug=true;
|
if(args.debug_given) debug=true;
|
||||||
|
|
||||||
|
@ -22,8 +22,11 @@ int MGraph::add_node(char* seg)
|
|||||||
while(*cat!=',' && *cat ) ++cat;
|
while(*cat!=',' && *cat ) ++cat;
|
||||||
if(*cat) ++cat;
|
if(*cat) ++cat;
|
||||||
|
|
||||||
Cat::add(cat);
|
// Cat::add(cat);
|
||||||
nodes[n].cat=cat;
|
if(Cat::index(cat)>0)
|
||||||
|
nodes[n].cat=cat;
|
||||||
|
else
|
||||||
|
nodes[n].cat="NULL";
|
||||||
|
|
||||||
nodes[n].pred.clear();
|
nodes[n].pred.clear();
|
||||||
|
|
||||||
|
@ -79,11 +79,11 @@ if($help)
|
|||||||
Usage: gph [OPTIONS]
|
Usage: gph [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-p tag Process segments with this tag as nodes.
|
--process=TYPE -p TYPE Process segments of type TYPE.
|
||||||
-r tag Start new graph at this tag.
|
--reset=TYPE -r TYPE Start new graph at tags of type TYPE.
|
||||||
-f filename Input file.
|
--inputfile=FILE -f FILE Input file.
|
||||||
-o filename Output file.
|
--outputfile=FILE -o FILE Output file.
|
||||||
-i Toggle interactive mode (default=off).
|
--interactive -i Toggle interactive mode (default=off).
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
exit 0;
|
exit 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user