Created
May 22, 2014 15:46
-
-
Save dginev/d1de6f8fd66a8a586e0e to your computer and use it in GitHub Desktop.
Paper Assigner for the NTCIR query brainstorming
This file contains hidden or 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
use strict; | |
use warnings; | |
use File::Slurp qw(read_file); | |
use Archive::Zip qw(:CONSTANTS :ERROR_CODES); | |
my @names = sort qw/Andrea Michael Mihnea Prode Constantin Fulya Florian Deyan/; | |
my $needed_papers = 3 * scalar(@names); | |
my @papers = split("\n",read_file('/arXMLiv/NTCIR_files.txt')); | |
my @chosen = map {$papers[$_]} sort map {int(rand(100_000))} 1..$needed_papers; | |
my $zip_handle = Archive::Zip->new(); | |
for my $i(0..$#names) { | |
for my $path(@chosen[(3*$i) .. (3*$i+2)]) { | |
$path =~ s/\/([^\/]+)\.html$//; | |
my $subdir = $1; | |
$zip_handle->addTree($path, "$names[$i]/$subdir"); | |
} | |
} | |
unless ( $zip_handle->writeToFileNamed('NTCIR_query_documents.zip') == AZ_OK ) { | |
die 'write error'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment