Bridget McInnes > UMLS-Similarity-1.31 > UMLS::Similarity::lin



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.07   Source   Latest Release: UMLS-Similarity-1.45


UMLS::Similarity::lin - Perl module for computing the semantic relatednessof concepts in the Unified Medical Language System (UMLS) using the method described by Lin (1997).


  title={{Using syntactic dependency as local context to resolve 
          word sense ambiguity}},
  author={Lin, D.},
  journal={Proceedings of the 35th Annual Meeting of the 
           Association for Computational Linguistics},


  use UMLS::Interface;
  use UMLS::Similarity::lin;

  my $umls = UMLS::Interface->new(); 
  die "Unable to create UMLS::Interface object.\n" if(!$umls);

  my $lin = UMLS::Similarity::lin->new($umls);
  die "Unable to create measure object.\n" if(!$lin);

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

  $ts1 = $umls->getTermList($cui1);
  my $term1 = pop @{$ts1};

  $ts2 = $umls->getTermList($cui2);
  my $term2 = pop @{$ts2};

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

  print "The similarity between $cui1 ($term1) and $cui2 ($term2) is $value\n";


This module computes the semantic relatedness of two concepts in the UMLS according to a method described by Lin (1998). The relatedness measure proposed by Lin is the IC(lcs) / IC(concept1) + IC(concept2). One can observe, then, that the similarity value will be greater-than or equal-to zero and less-than or equal-to one.

If the information content of any of either concept1 or concept2 is zero, then zero is returned as the relatedness score, due to lack of data. Ideally, the information content of a synset would be zero only if that synset were the root node, but when the frequency of a synset is zero, we use the value of zero as the information content because of a lack of better alternatives.

The IC of a concept is defined as the negative log of the probabilty of the concept.

To use this measure, a propagation file containing the probability of a CUI for each of the CUIs from the source(s) specified in the configuration file. The format for this file is as follows:


A larger of example of this file can be found in the icpropagation file in the samples/ directory.

A propagation file can be created using the and the programs in the utils/ directory. The program takes plain text and returns a list of CUIs that are mapped to the text and the CUIs frequency counts. This file can then be used by the program to create a file containing a list of CUIs and their probability counts, or used directly by the program which will calculate the probability of a concept on the fly.


The Information Content (IC) is defined as the negative log of the probability of a concept. The probability of a concept, c, is determine by summing the probability of the concept ocurring in some text plus the probability its decendants occuring in some text:

For more information on how this is calculated please see the README file.


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


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

   use UMLS::Similarity::lin;
   $measure = UMLS::Similarity::lin->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 (UMLS-Interface).

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 semantic 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');


The UMLS-Interface package takes a configuration file to determine which sources and relations to use when obtaining the path information.

The format of the configuration file is as follows:

SAB :: <include|exclude> <source1, source2, ... sourceN>

REL :: <include|exclude> <relation1, relation2, ... relationN>

For example, if we wanted to use the MSH vocabulary with only the RB/RN relations, the configuration file would be:

SAB :: include MSH REL :: include RB, RN


SAB :: include MSH REL :: exclude PAR, CHD

If you go to the configuration file directory, there will be example configuration files for the different runs that you have performed.

For more information about the configuration options please see the README.


perl(1), UMLS::Interface

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


  If you have any trouble installing and using UMLS-Similarity, 
  please contact us via the users mailing list :

  You can join this group by going to:

  You may also contact us directly if you prefer :

      Bridget T. McInnes: bthomson at 

      Ted Pedersen : tpederse at


  Bridget T McInnes <bthomson at>
  Siddharth Patwardhan <sidd at>
  Serguei Pakhomov <pakh0002 at>
  Ted Pedersen <tpederse at>


Copyright 2004-2011 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.

syntax highlighting: