Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <s0565741@odin.inf.ed.ac.uk>2014-04-24 20:48:12 +0400
committerHieu Hoang <s0565741@odin.inf.ed.ac.uk>2014-04-24 20:48:12 +0400
commitda6ade7d94b0489234b097ae59703a13451cfa23 (patch)
treec26fe70e7fe3a5cd60e188c04820859d6d17828a /contrib/other-builds/extract-mixed-syntax
parentb917ac552ffda7661bc9966f0e75fe690d1a58a4 (diff)
parent3f32e48f97150d04e70fa835ddf9a3c79f6d30cf (diff)
get-by-line-number.perl
Diffstat (limited to 'contrib/other-builds/extract-mixed-syntax')
-rwxr-xr-xcontrib/other-builds/extract-mixed-syntax/learnable/equal.perl33
-rwxr-xr-xcontrib/other-builds/extract-mixed-syntax/learnable/get-by-line-number.perl29
2 files changed, 62 insertions, 0 deletions
diff --git a/contrib/other-builds/extract-mixed-syntax/learnable/equal.perl b/contrib/other-builds/extract-mixed-syntax/learnable/equal.perl
new file mode 100755
index 000000000..e43b48a84
--- /dev/null
+++ b/contrib/other-builds/extract-mixed-syntax/learnable/equal.perl
@@ -0,0 +1,33 @@
+#! /usr/bin/perl -w
+
+use strict;
+
+sub trim($);
+
+my $file1 = $ARGV[0];
+my $file2 = $ARGV[1];
+
+open (FILE1, $file1);
+open (FILE2, $file2);
+
+my $countEqual = 0;
+while (my $line1 = <FILE1>) {
+ my $line2 = <FILE2>;
+ if (trim($line1) eq trim($line2)) {
+ ++$countEqual;
+ }
+}
+
+print $countEqual ."\n";
+
+
+######################
+# Perl trim function to remove whitespace from the start and end of the string
+sub trim($) {
+ my $string = shift;
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+ return $string;
+}
+
+
diff --git a/contrib/other-builds/extract-mixed-syntax/learnable/get-by-line-number.perl b/contrib/other-builds/extract-mixed-syntax/learnable/get-by-line-number.perl
new file mode 100755
index 000000000..f9ec9e39b
--- /dev/null
+++ b/contrib/other-builds/extract-mixed-syntax/learnable/get-by-line-number.perl
@@ -0,0 +1,29 @@
+#! /usr/bin/perl -w
+
+use strict;
+
+binmode(STDIN, ":utf8");
+binmode(STDOUT, ":utf8");
+binmode(STDERR, ":utf8");
+
+my $fileLineNum = $ARGV[0];
+open (FILE_LINE_NUM, $fileLineNum);
+
+my $nextLineNum = <FILE_LINE_NUM>;
+
+my $lineNum = 1;
+while (my $line = <STDIN>) {
+ if (defined($nextLineNum) && $lineNum == $nextLineNum) {
+ # matches. output line
+ chomp($line);
+ print "$line\n";
+
+ # next line number
+ $nextLineNum = <FILE_LINE_NUM>;
+ }
+
+ ++$lineNum;
+}
+
+
+