Bridget McInnes > UMLS-Similarity-0.01 > UMLS::Similarity::lch

Download:
UMLS-Similarity-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01   Source   Latest Release: UMLS-Similarity-0.29

NAME ^

UMLS::Similarity::lch - Perl module for computing semantic relatedness of word senses using the method described by Leacock and Chodorow (1998). This module is a taxonomy independent implementation of the algorithm.

SYNOPSIS ^

  use UMLS::Similarity::lch;

  use WordNet::Interface;

  my $interface = WordNet::Interface->new();

  my $myobj = UMLS::Similarity::lch->new($interface);

  my $cui1 = "C0005767";
  my $cui2 = "C0007634";

  my $value = $myobj->getRelatedness($cui1, $cui2);

  ($error, $errorString) = $myobj->getError();

  die "$errorString\n" if($error);

  print "Similarity (lch) : $cui1 <-> $cui2 = $value\n";

DESCRIPTION ^

This module computes the semantic relatedness of word senses according to a method described by Leacock and Chodorow (1998). This method counts up the number of edges between the concepts in the backend taxonomy. This value is then scaled by the maximum depth of the taxonomy. A relatedness value is obtained by taking the negative log of this scaled value.

USAGE ^

The semantic relatedness modules in this distribution are built as classes that expose the following methods: new() getRelatedness() getError() getTraceString()

See the UMLS::Similarity(3) documentation for details of these methods.

TYPICAL USAGE EXAMPLES ^

To create an object of the lch measure, we would have the following lines of code in the perl program.

   use UMLS::Similarity::lch;
   $measure = UMLS::Similarity::lch->new($interface);

The reference of the initialized object is stored in the scalar variable '$measure'. '$interface' contains an interface object that should have been created earlier in the program. The interface object defines methods to access a backend taxonomy (such as UMLS, etc.).

If the 'new' method is unable to create the object, '$measure' would be undefined. This, as well as any other error/warning may be tested.

   die "Unable to create object.\n" if(!defined $measure);
   ($err, $errString) = $measure->getError();
   die $errString."\n" if($err);

To find the sematic relatedness of the concept 'blood' (C0005767) and the concept 'cell' (C0007634) using the measure, we would write the following piece of code:

   $relatedness = $measure->getRelatedness('C0005767', 'C0007634');

To get traces for the above computation:

   print $measure->getTraceString();

However, traces must be enabled using configuration files. By default traces are turned off.

SEE ALSO ^

perl(1), UMLS::Similarity(3)

http://www.cogsci.princeton.edu/~wn

http://www.ai.mit.edu/people/jrennie/WordNet

http://groups.yahoo.com/group/wn-similarity

AUTHORS ^

  Bridget T McInnes <bthomson@cs.umn.edu>
  Siddharth Patwardhan <sidd@cs.utah.edu>
  Serguei Pakhomov <pakhomov.serguei@mayo.edu>
  Ted Pedersen <tpederse@d.umn.edu>

COPYRIGHT AND LICENSE ^

Copyright 2004-2009 by Bridget T McInnes, Siddharth Patwardhan, Serguei Pakhomov and Ted Pedersen

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.