Add w2v->compare_to parameter and use for count-based delta calcs
Change-Id: Ic53cbc5b3984659b3ebfa6c8ad30fd42850a9fc9
diff --git a/lib/IDS/DeReKoVecs/Read.pm b/lib/IDS/DeReKoVecs/Read.pm
index fb11fe9..6e2acfc 100644
--- a/lib/IDS/DeReKoVecs/Read.pm
+++ b/lib/IDS/DeReKoVecs/Read.pm
@@ -43,15 +43,18 @@
}
sub getClassicCollocatorsCached {
- my ($c, $word) = @_;
+ my ($c, $word, $compare_to) = @_;
my $s2 = "";
if($word > $mergedEnd) {
$word-=$mergedEnd;
}
- if($opt_p >= 5000 && $opt_p < 5600) { # German non-reference
- open PIPE, "GET http://corpora.ids-mannheim.de/openlab/derekovecs/getClassicCollocators?w=$word |";
+ my $pipe;
+ if($compare_to ne "") {
+ $c->app->log->info("comparing syn neighbours to: $compare_to/getClassicCollocators?w=$word");
+ open $pipe, "lwp-request $compare_to/getClassicCollocators?w=$word |";
}
+
if($opt_C || !$cccache{$word}) {
$c->app->log->info("Getting classic collocates of $word.");
$cccache{$word} = getClassicCollocators($word);
@@ -60,11 +63,12 @@
} else {
$c->app->log->info("Getting classic collocates for $word from cache.");
}
- if($opt_p >= 5000 && $opt_p < 5600) { # German non-reference
- while(<PIPE>) {
+
+ if(defined($pipe)) {
+ while(<$pipe>) {
$s2 .= $_;
}
- close(PIPE);
+ close($pipe);
}
if(length($s2) > 2000) {