Skip to content

Instantly share code, notes, and snippets.

@note103
Created May 29, 2016 02:09
Show Gist options
  • Save note103/45d97352e27cf2205a2d49f577c6b293 to your computer and use it in GitHub Desktop.
Save note103/45d97352e27cf2205a2d49f577c6b293 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use File::Slurp;
my @ted_en = read_file('ted_en.txt');
my @ted_ja = read_file('ted_ja.txt');
my @out;
for my $te (@ted_en) {
chomp $te;
$te =~ s/"/\\"/g;
for my $tj (@ted_ja) {
chomp $tj;
print " \"$te\" : \"$tj\",\n";
push @out, " \"$te\" : \"$tj\",\n";
@ted_ja = grep {$_ ne $tj} @ted_ja;
last;
}
}
write_file('ted_merged.txt', @out);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment