help
Rev | Line | |
---|
[0214596] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | #package: UAM TExt Tools |
---|
| 4 | #component: canonize |
---|
| 5 | #version: 1.0 |
---|
| 6 | #author: Tomasz Obrebski |
---|
| 7 | |
---|
| 8 | use strict; |
---|
| 9 | use Getopt::Long; |
---|
| 10 | use attr; |
---|
| 11 | #use File::HomeDir; |
---|
| 12 | #use lib "$ENV{HOME}/.utt/lib/perl"; |
---|
| 13 | |
---|
| 14 | my $help; |
---|
| 15 | |
---|
| 16 | GetOptions("help|h" => \$help); |
---|
| 17 | |
---|
| 18 | if($help) |
---|
| 19 | { |
---|
| 20 | print <<'END' |
---|
| 21 | |
---|
| 22 | Transforms syntactic categories to their canonical form. |
---|
| 23 | |
---|
| 24 | Usage: canonize |
---|
| 25 | |
---|
| 26 | Options: |
---|
| 27 | --help -h Help. |
---|
| 28 | |
---|
| 29 | END |
---|
| 30 | ; |
---|
| 31 | exit 0; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | #$|=1; |
---|
| 35 | |
---|
| 36 | my %tra; |
---|
| 37 | |
---|
| 38 | while(<>) |
---|
| 39 | { |
---|
| 40 | s/$attr::pos_re\/$attr::avlist_re/trans($&)/ge; |
---|
| 41 | print; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | sub trans |
---|
| 45 | { |
---|
| 46 | my $cat=shift; |
---|
| 47 | exists($tra{$cat}) ? $tra{$cat} : ( $tra{$cat} = attr::canonize $cat ); |
---|
| 48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.