From ba99c3a4e5b73d955c2fb48cd16d5be2fbdd968e Mon Sep 17 00:00:00 2001 From: redpony Date: Wed, 1 Dec 2010 02:46:07 +0000 Subject: stemmers git-svn-id: https://ws10smt.googlecode.com/svn/trunk@737 ec762483-ff6d-05da-a07a-a48fb63a330f --- word-aligner/stemmers/zh.pl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 word-aligner/stemmers/zh.pl (limited to 'word-aligner/stemmers/zh.pl') 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() { + 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"; + } +} + -- cgit v1.2.3