ser i grp obsluguja tags

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@38 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
This commit is contained in:
obrebski 2008-05-07 12:48:49 +00:00
parent df77b87018
commit f5d3b20097
2 changed files with 27 additions and 2 deletions

View File

@ -27,6 +27,7 @@ my $show_command=0;
my $action="pgP"; my $action="pgP";
my $eos="seg(EOS)"; my $eos="seg(EOS)";
my $morfield='lem'; my $morfield='lem';
my $tags=0;
#read configuration files########################### #read configuration files###########################
my $file; my $file;
@ -60,6 +61,9 @@ foreach $file ($systemconfigfile, $userconfigfile){
elsif($name eq "action"){ elsif($name eq "action"){
$action; $action;
} }
elsif($name eq "tags"){
$tags=$value;
}
elsif(($name eq "help")or($name eq "h")){ elsif(($name eq "help")or($name eq "h")){
$help=1; $help=1;
} }
@ -77,6 +81,7 @@ GetOptions("pattern|e=s" => \$pattern,
"define=s" => \$macrofile, "define=s" => \$macrofile,
"command" => \$show_command, "command" => \$show_command,
"action=s" => \$action, "action=s" => \$action,
"tags=s" => \$tags,
"help|h" => \$help); "help|h" => \$help);
if($help) if($help)
@ -96,6 +101,7 @@ Options:
g - grep g - grep
P - postprocess P - postprocess
(default pgP) (default pgP)
--tags=STRING Morphosyntactic tag format.
--command Print the shell command to be executed and exit. --command Print the shell command to be executed and exit.
--help -h Help. --help -h Help.
END END
@ -109,6 +115,13 @@ die("$0: macro file not found") unless
$macrofile or $macrofile or
-e "$LIB_DIR/terms.m4" and $macrofile="$LIB_DIR/terms.m4"; -e "$LIB_DIR/terms.m4" and $macrofile="$LIB_DIR/terms.m4";
die("$0: undefined tagset format (tags option missing)") unless
$tags;
die("$0: $tags.tag2re program not found") unless
1; #JAK NAPISAC WARUNEK???
my $uncompress = ($action =~ /u/) ? ' lzop -cd | ' : ''; my $uncompress = ($action =~ /u/) ? ' lzop -cd | ' : '';
my $preproc = ($action =~ /p/) ? ' fla | ' : ''; my $preproc = ($action =~ /p/) ? ' fla | ' : '';
@ -131,7 +144,7 @@ chomp $grepre;
# <> expansion # <> expansion
$grepre =~ s/<([^>]+)>/`echo $1 | tag2re`/ge; $grepre =~ s/<([^>]+)>/`echo $1 | $tags.tag2re`/ge;
$grepre =~ s/\./[^ [:cntrl:]]/g; $grepre =~ s/\./[^ [:cntrl:]]/g;

View File

@ -25,6 +25,7 @@ my $macros=0;
my $flextemplate=0; my $flextemplate=0;
my $flex=0; my $flex=0;
my $morfield='lem'; my $morfield='lem';
my $tags=0;
#read configuration files########################### #read configuration files###########################
my $file; my $file;
@ -55,6 +56,9 @@ foreach $file ($systemconfigfile, $userconfigfile){
elsif($name eq "flex-template"){ elsif($name eq "flex-template"){
$flextemplate=$value; $flextemplate=$value;
} }
elsif($name eq "tags"){
$tags=$value;
}
elsif($name eq "flex"){ elsif($name eq "flex"){
$flex=1; $flex=1;
} }
@ -74,6 +78,7 @@ GetOptions("pattern|e=s" => \$pattern,
"no-markers|M" => \$no_markers, "no-markers|M" => \$no_markers,
"macros=s" => \$macros, "macros=s" => \$macros,
"flex-template=s" => \$flextemplate, "flex-template=s" => \$flextemplate,
"tags=s" => \$tags,
"flex" => \$flex, "flex" => \$flex,
"help|h" => \$help); "help|h" => \$help);
@ -88,6 +93,7 @@ Options:
--morph=STRING Field containing morphological information (default 'lem'). --morph=STRING Field containing morphological information (default 'lem').
--macros=FILE Read macrodefinitions from FILE. --macros=FILE Read macrodefinitions from FILE.
--flex-template=FILE Read flex code template from FILE. --flex-template=FILE Read flex code template from FILE.
--tags=STRING Morphosyntactic tag format.
--only-matching -m Print only fragments matching PATTERN. --only-matching -m Print only fragments matching PATTERN.
--no-markers -M Do not print BOM and EOM markers [TODO]. --no-markers -M Do not print BOM and EOM markers [TODO].
--flex Print only the generated flex code and exit. --flex Print only the generated flex code and exit.
@ -107,6 +113,12 @@ die("$0: macro file not found") unless
$macros or $macros or
-e "$LIB_DIR/terms.m4" and $macros="$LIB_DIR/terms.m4"; -e "$LIB_DIR/terms.m4" and $macros="$LIB_DIR/terms.m4";
die("$0: $tags.tag2re program not found") unless
1; #JAK NAPISAC WARUNEK???
die("$0: undefined tagset format (tags option missing)") unless
$tags;
#$pattern =~ s/cat\(([^)]+)\)/'cat('.pre($1).')'/ge; #$pattern =~ s/cat\(([^)]+)\)/'cat('.pre($1).')'/ge;
# quoting escaped commas /NIE DZIA£A/ # quoting escaped commas /NIE DZIA£A/
@ -127,7 +139,7 @@ die("Incorrect pattern (m4).") if $? >> 8;
chomp $flexpattern; chomp $flexpattern;
# <> expansion # <> expansion
$flexpattern =~ s/<([^>]+)>/`echo $1 | tag2re`/ge; $flexpattern =~ s/<([^>]+)>/`echo $1 | $tags.tag2re`/ge;
# restricting the value of the . special symbol # restricting the value of the . special symbol
$flexpattern =~ s/\./[^ \\t\\n\\r\\f]/g; $flexpattern =~ s/\./[^ \\t\\n\\r\\f]/g;