Created
May 29, 2016 02:09
-
-
Save note103/45d97352e27cf2205a2d49f577c6b293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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