source: app/src/dgp/canonize @ 0214596

help
Last change on this file since 0214596 was 0214596, checked in by pawelk <pawelk@…>, 16 years ago

Dodalismy do pakietu utt komponent dgp (brak configow i innych bajerow).

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@24 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

  • Property mode set to 100755
File size: 608 bytes
Line 
1#!/usr/bin/perl
2
3#package:       UAM TExt Tools
4#component:     canonize
5#version:       1.0
6#author:        Tomasz Obrebski
7
8use strict;
9use Getopt::Long;
10use attr;
11#use File::HomeDir;
12#use lib "$ENV{HOME}/.utt/lib/perl";
13
14my $help;
15
16GetOptions("help|h" => \$help);
17
18if($help)
19{
20    print <<'END'
21
22Transforms syntactic categories to their canonical form.
23
24Usage: canonize
25
26Options:
27   --help -h                    Help.
28
29END
30;
31    exit 0;
32}
33
34#$|=1;
35
36my %tra;
37
38while(<>)
39{
40    s/$attr::pos_re\/$attr::avlist_re/trans($&)/ge;
41    print;
42}
43
44sub 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.