diff options
author | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-12-01 02:46:07 +0000 |
---|---|---|
committer | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-12-01 02:46:07 +0000 |
commit | ba99c3a4e5b73d955c2fb48cd16d5be2fbdd968e (patch) | |
tree | 76320eeea49ee7b751276083f4a4ff2e25fb6715 | |
parent | 6731e1bc2f876127e592f0a6d069717d1624c3ef (diff) |
stemmers
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@737 ec762483-ff6d-05da-a07a-a48fb63a330f
-rwxr-xr-x | word-aligner/stemmers/zh.pl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/word-aligner/stemmers/zh.pl b/word-aligner/stemmers/zh.pl new file mode 100755 index 00000000..14ba8aab --- /dev/null +++ b/word-aligner/stemmers/zh.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl -w + +use strict; +use utf8; + +binmode(STDIN, ":utf8"); +binmode(STDOUT,":utf8"); + +my $vocab = undef; +if (scalar @ARGV > 0) { + die "Only allow --vocab" unless ($ARGV[0] eq '--vocab' && scalar @ARGV == 1); + $vocab = 1; +} + +my %dict; +while(<STDIN>) { + chomp; + my @words = split /\s+/; + my @out = @words; + if ($vocab) { + die "Expected exactly one word per line with --vocab: $_" unless scalar @out == 1; + print "$_ @out\n"; + } else { + print "@out\n"; + } +} + |