| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use FindBin qw($Bin); |
| 4 |
use lib "$Bin/../lib"; |
| 5 |
|
| 6 |
if (@ARGV < 2) { |
| 7 |
print "Usage: apply_rules <rule source file> <thesaurus source file>\n"; |
| 8 |
exit 1; |
| 9 |
} |
| 10 |
|
| 11 |
use Biblio::Thesaurus; |
| 12 |
use Biblio::Thesaurus::ModRewrite; |
| 13 |
|
| 14 |
my $code = <<"EOF"; |
| 15 |
"$ARGV[0]" \$r \$t => sub { print " \\"\$t\\" [style=\\"filled\\",color=\\"orange\\"] \\"$ARGV[0]\\" -> \$t [ label = \\"\$r\\" ] ;\\n"; }. |
| 16 |
\$t \$r "$ARGV[0]" => sub { print " \\"\$t\\" [style=\\"filled\\",color=\\"greenyellow\\"] \$t -> \\"$ARGV[0]\\" [ label = \\"\$r\\" ] ;\\n"; }. |
| 17 |
EOF |
| 18 |
|
| 19 |
my $obj = thesaurusLoad($ARGV[1]); |
| 20 |
$t = Biblio::Thesaurus::ModRewrite->new($obj); |
| 21 |
|
| 22 |
print "digraph zbr {\n rankdir=LR\n\"$ARGV[0]\" [style=\"filled\",color=\"red\"]\n"; |
| 23 |
$t->process($code); |
| 24 |
print "}\n"; |