Subject: | undefined value returned from sub TF - bug fix patch included |
Date: | Fri, 2 Dec 2016 10:35:13 +0100 |
To: | bug-Text-TFIDF [...] rt.cpan.org |
From: | Mark Wilkinson UPM <mark.wilkinson [...] upm.es> |
Dear Module Author,
Fixed Line 54 of Text::TFIDF to return a value "0" instead of undef if
the word doesn't appear in the file.
new code:
-----------------
sub TF {
my $self = shift;
my $file = shift;
my $word = shift;
return $self->{file}->{$file}->{$word} ?
$self->{file}->{$file}->{$word} : 0;
}
-------------------
Cheers!
Mark
--
Dr. Mark D. Wilkinson
BBVA-UPM Industry Chair on Biotechnology
Isaac Peral Distinguished Researcher
Centro de Biotecnología y Genómica de Plantas UPM-INIA (CBGP)
Campus Montegancedo,
Autopista M-40 (Km 38)
28223-Pozuelo de Alarcón (Madrid)
“There is no cost to getting things wrong.
The cost is not getting them published.”
--Brian Nosek