| 1 | # UMLS::Similarity::random.pm | ||
| 2 | # | ||
| 3 | # Module which assigns a random number between zero and one as | ||
| 4 | # the similarity score | ||
| 5 | # | ||
| 6 | # Copyright (c) 2009-2011, | ||
| 7 | # | ||
| 8 | # Bridget T McInnes, University of Minnesota, Twin Cities | ||
| 9 | # bthomson at umn.edu | ||
| 10 | # | ||
| 11 | # Siddharth Patwardhan, University of Utah, Salt Lake City | ||
| 12 | # sidd at cs.utah.edu | ||
| 13 | # | ||
| 14 | # Serguei Pakhomov, University of Minnesota, Twin Cities | ||
| 15 | # pakh002 at umn.edu | ||
| 16 | # | ||
| 17 | # Ted Pedersen, University of Minnesota, Duluth | ||
| 18 | # tpederse at d.umn.edu | ||
| 19 | # | ||
| 20 | # Ying Liu, University of Minnesota | ||
| 21 | # liux0935 at umn.edu | ||
| 22 | # | ||
| 23 | # This program is free software; you can redistribute it and/or | ||
| 24 | # modify it under the terms of the GNU General Public License | ||
| 25 | # as published by the Free Software Foundation; either version 2 | ||
| 26 | # of the License, or (at your option) any later version. | ||
| 27 | # | ||
| 28 | # This program is distributed in the hope that it will be useful, | ||
| 29 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 30 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 31 | # GNU General Public License for more details. | ||
| 32 | # | ||
| 33 | # You should have received a copy of the GNU General Public License | ||
| 34 | # along with this program; if not, write to | ||
| 35 | # | ||
| 36 | # The Free Software Foundation, Inc., | ||
| 37 | # 59 Temple Place - Suite 330, | ||
| 38 | # Boston, MA 02111-1307, USA. | ||
| 39 | |||
| 40 | |||
| 41 | package UMLS::Similarity::random; | ||
| 42 | |||
| 43 | use strict; | ||
| 44 | use warnings; | ||
| 45 | use UMLS::Similarity; | ||
| 46 | use UMLS::Similarity::ErrorHandler; | ||
| 47 | |||
| 48 | use vars qw($VERSION); | ||
| 49 | $VERSION = '0.05'; | ||
| 50 | |||
| 51 | my $debug = 0; | ||
| 52 | |||
| 53 | sub new | ||
| 54 | { | ||
| 55 | my $className = shift; | ||
| 56 | return undef if(ref $className); | ||
| 57 | |||
| 58 | if($debug) { print STDERR "In UMLS::Similarity::random->new()\n"; } | ||
| 59 | |||
| 60 | my $interface = shift; | ||
| 61 | |||
| 62 | my $self = {}; | ||
| 63 | |||
| 64 | # Bless the object. | ||
| 65 | bless($self, $className); | ||
| 66 | |||
| 67 | # The backend interface object. | ||
| 68 | $self->{'interface'} = $interface; | ||
| 69 | |||
| 70 | return $self; | ||
| 71 | } | ||
| 72 | |||
| 73 | |||
| 74 | sub getRelatedness | ||
| 75 | { | ||
| 76 | my $self = shift; | ||
| 77 | |||
| 78 | return undef if(!defined $self || !ref $self); | ||
| 79 | |||
| 80 | my $concept1 = shift; | ||
| 81 | my $concept2 = shift; | ||
| 82 | |||
| 83 | # return a random number between zero and one | ||
| 84 | my $score = rand(); | ||
| 85 | |||
| 86 | return $score | ||
| 87 | } | ||
| 88 | |||
| 89 | 1; | ||
| 90 | __END__ |