From f5d3b20097c280ad859675079ea5c7bc804b9815 Mon Sep 17 00:00:00 2001 From: obrebski Date: Wed, 7 May 2008 12:48:49 +0000 Subject: [PATCH] ser i grp obsluguja tags git-svn-id: svn://atos.wmid.amu.edu.pl/utt@38 e293616e-ec6a-49c2-aa92-f4a8b91c5d16 --- app/src/grp/grp | 15 ++++++++++++++- app/src/ser/ser | 14 +++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/src/grp/grp b/app/src/grp/grp index 3480d83..2739b9d 100755 --- a/app/src/grp/grp +++ b/app/src/grp/grp @@ -27,6 +27,7 @@ my $show_command=0; my $action="pgP"; my $eos="seg(EOS)"; my $morfield='lem'; +my $tags=0; #read configuration files########################### my $file; @@ -60,6 +61,9 @@ foreach $file ($systemconfigfile, $userconfigfile){ elsif($name eq "action"){ $action; } + elsif($name eq "tags"){ + $tags=$value; + } elsif(($name eq "help")or($name eq "h")){ $help=1; } @@ -77,6 +81,7 @@ GetOptions("pattern|e=s" => \$pattern, "define=s" => \$macrofile, "command" => \$show_command, "action=s" => \$action, + "tags=s" => \$tags, "help|h" => \$help); if($help) @@ -96,6 +101,7 @@ Options: g - grep P - postprocess (default pgP) + --tags=STRING Morphosyntactic tag format. --command Print the shell command to be executed and exit. --help -h Help. END @@ -109,6 +115,13 @@ die("$0: macro file not found") unless $macrofile or -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 $preproc = ($action =~ /p/) ? ' fla | ' : ''; @@ -131,7 +144,7 @@ chomp $grepre; # <> expansion -$grepre =~ s/<([^>]+)>/`echo $1 | tag2re`/ge; +$grepre =~ s/<([^>]+)>/`echo $1 | $tags.tag2re`/ge; $grepre =~ s/\./[^ [:cntrl:]]/g; diff --git a/app/src/ser/ser b/app/src/ser/ser index c50e1ff..4a8d658 100755 --- a/app/src/ser/ser +++ b/app/src/ser/ser @@ -25,6 +25,7 @@ my $macros=0; my $flextemplate=0; my $flex=0; my $morfield='lem'; +my $tags=0; #read configuration files########################### my $file; @@ -55,6 +56,9 @@ foreach $file ($systemconfigfile, $userconfigfile){ elsif($name eq "flex-template"){ $flextemplate=$value; } + elsif($name eq "tags"){ + $tags=$value; + } elsif($name eq "flex"){ $flex=1; } @@ -74,6 +78,7 @@ GetOptions("pattern|e=s" => \$pattern, "no-markers|M" => \$no_markers, "macros=s" => \$macros, "flex-template=s" => \$flextemplate, + "tags=s" => \$tags, "flex" => \$flex, "help|h" => \$help); @@ -88,6 +93,7 @@ Options: --morph=STRING Field containing morphological information (default 'lem'). --macros=FILE Read macrodefinitions from FILE. --flex-template=FILE Read flex code template from FILE. + --tags=STRING Morphosyntactic tag format. --only-matching -m Print only fragments matching PATTERN. --no-markers -M Do not print BOM and EOM markers [TODO]. --flex Print only the generated flex code and exit. @@ -107,6 +113,12 @@ die("$0: macro file not found") unless $macros or -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; # quoting escaped commas /NIE DZIAŁA/ @@ -127,7 +139,7 @@ die("Incorrect pattern (m4).") if $? >> 8; chomp $flexpattern; # <> expansion -$flexpattern =~ s/<([^>]+)>/`echo $1 | tag2re`/ge; +$flexpattern =~ s/<([^>]+)>/`echo $1 | $tags.tag2re`/ge; # restricting the value of the . special symbol $flexpattern =~ s/\./[^ \\t\\n\\r\\f]/g;