#!/usr/bin/perl -w
use strict 'refs';
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
$|++;
$CGI::DISABLE_UPLOADS = 0;
my $ROOT = '/home/hal/public_html/WhatToSee';
my $DATE = getdate();
print header;
my $JAVASCRIPT=<"WhatToSee", -script=>$JAVASCRIPT);
my $task = param('task');
print "
WhatToSee
\n";
if ((not defined $task) || ($task eq '')) {
print<you like to cite with what new papers are citing. High overlap means the paper is probably relevant to you. Sure there are counter-examples, but overall I have found it useful (eg., it has suggested papers to me that are interesting that I would otherwise have missed). Of course, you should also read through titles since that is a somewhat orthogonal source of information.
Here is how to use the system. You upload your personal bibtex file and have the system compare it to a known conference index; it will then present a list of papers, sorted by relevance. If you want to compare to a conference that is not yet indexed, you need to request that indexing take place. This takes about 30 seconds per paper, so you will probably have to be patient.
ENDBEGIN
print "
Compare to Known Index
\n";
print start_multipart_form();
print "Path to your bibfile: ";
print hidden('task', 'compare');
print filefield('bibfile','',50);
print " Select indices: ";
open L, "ls $ROOT/index/* |" or die;
my %urls = ();
while (my $indexfile = ) {
chomp $indexfile;
open F, $indexfile or die "cannot read index $indexfile ($!)";
my $url = '';
my $name = '';
my $numlines = 0;
while () {
chomp;
if ($numlines == 0) { $url = $_; }
if ($numlines == 1) { $name = $_; }
$numlines++;
}
if (($url eq '') || ($numlines < 10)) { next; }
if ($name =~ /^([^\s]+)[\s]+(.+)$/) {
my $conf = $1; my $year = $2;
$urls{$conf}{$year}{URL} = $url;
$urls{$conf}{$year}{IDX} = $indexfile;
} else {
$urls{$name}{''}{URL} = $url;
$urls{$name}{''}{IDX} = $indexfile;
}
}
print "
\n";
my $addr = $ENV{'REMOTE_ADDR'} || 'UNKaddr';
my $outFile = "$ROOT/bibs/$DATE.$addr.bz2";
if (not -e $outFile) {
open F, "| bzip2 -9 > $outFile" or die;
open I, $tmpfile or die;
while () { print F $_; }
close I or die;
close F;
}
open F, "$ROOT/compare_bib_and_index.pl $tmpfile $indexfile |" or die;
print "
\n";
print "
Score
Paper
\n";
my $n = 0;
my %hit = ();
while () {
chomp;
my ($sim, $title, $pdf) = split /\t/, $_;
if (exists $hit{$pdf}) { next; }
$hit{$pdf} = 1;
$sim = int($sim * 1000) / 10;
print "