Bridget McInnes > UMLS-Similarity-1.33 > UMLS::Similarity::vector

Download:
UMLS-Similarity-1.33.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.11   Source   Latest Release: UMLS-Similarity-1.35

NAME ^

UMLS::Similarity::vector - Perl module for computing semantic relatedness of concepts in the Unified Medical Language System (UMLS) using the method described by Patwardhan and Pedersen (2006).

CITATION ^

 @inproceedings{PatwardhanP06,
  title={{Using WordNet-based Context Vectors to Estimate 
          the Semantic Relatedness of Concepts}},
  author={Patwardhan, S. and Pedersen, T.},
  booktitle={Proceedings of the EACL 2006 Workshop Making Sense
             of Sense - Bringing Computational Linguistics and 
             Psycholinguistics Together},
  volume={1501},
  pages={1-8},
  year={2006},
  month={April},
  address={Trento, Italy}
 }

SYNOPSIS ^

  use UMLS::Interface;
  use UMLS::Similarity::vector;

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

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

  my $cui1 = "C0018563";
  my $cui2 = "C0037303";

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

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

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

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

DESCRIPTION ^

This module computes the semantic relatedness of two concepts in the UMLS according to a method described by Patwardhan & Pedersen (2006). "Using WordNet Based Context Vectors to Estimate the Semantic Relatedness of Concepts" (Patwardhan and Pedersen) - Appears in the Proceedings of the EACL 2006 Workshop Making Sense of Sense - Bringing Computational Linguistics and Psycholinguistics Together, pp. 1-8, April 4, 2006, Trento, Italy. http://www.d.umn.edu/~tpederse/Pubs/eacl2006-vector.pdf

--indexfile and --matrixfile option

The co-occurrence matrix and index file used in the vector method are prepared by vector-input.pl method. Index file assigns each term of the bigrams a number and also records the vector position and length which starts the term of the co-occurrence matrix. For example, for the following bigrams list which are generated by the text "This is the first line Of a LONG file.":

        9
        LONG<>file<>1 1 1
        Of<>a<>1 1 1
        This<>is<>1 1 1
        a<>LONG<>1 1 1
        file<>.<>1 1 1
        first<>line<>1 1 1
        is<>the<>1 1 1
        line<>Of<>1 1 1
        the<>first<>1 1 1

The index file for the terms show up in the above will be:

        . 1 0
        LONG 2 0 8
        Of 3 8 8
        This 4 16 8
        a 5 24 8
        file 6 32 8
        first 7 40 8
        is 8 48 9
        line 9 57 8
        the 10 65 9

The co-occurrence matrix file will be:

        2: 6 1
        3: 5 1
        4: 8 1
        5: 2 1
        6: 1 1
        7: 9 1
        8: 10 1
        9: 3 1
        10: 7 1

Each index file assigns the term a number and also record the vector start position and length of the vector of the co-occurrence matrix. For example, the first line of the matrix file "2: 6 1" means for the term '2' which is 'LONG', it has a bigram pair with term '6' which is 'file', and the frequency is 1. In the index file, for the term 'LONG', it use '2' to represent 'LONG' and it starts at the '0' position of the file(byte) and the vector has length '8'. The vector-input.pl requires the bigrams are sorted, and you could use count2huge.pl method of Text-NSP to convert the output of count.pl to huge-count.pl.

--defraw option

This is a flag for the vector measure. The definitions used are 'cleaned'. If the --defraw flag is set they will not be cleaned, and it will leave the definitions in their "raw" form. If the --defraw and --stem option use together, the --stem option will cancel the request for "raw" defintion which is set by --defraw.

--dictfile option

This is a dictionary file for the vector measure. It contains the 'definitions' of a concept which would be used in the relatedness computation. When this option is set, for the input pair, umls-similarity.pl first find the CUIs or terms definition in the dictfile. If the --config option is set, umls-similarity.pl will find the definition in dictfile and in UMLS. And then, the relatedness is computed by the combinition of UMLS and dictfile defintions.

If the --dictfile option is not set, the definiton will only come from the UMLS defintion by the --config option.

The input pair could be the following formats.

    1. cui1/term1 cui2/term2 
       without --dictfile option and without --config option, 
       use the UMLS definition of the default config file. 

    2. cui1/term1 cui2/term2  --dictfile ./sample/dictfile
       --dictfile option is set and without --config option, 
       definitions only come from dictfile. 

    3. cui1/term1 cui2/term2  --config ./sample/leskmeasure.config
       without --dictfile option, --config option is set, 
       definitions only come from UMLS by the config file. 

    4. cui1/term1 cui2/term2  --dictfile ./sample/dictfile --config ./sample/leskmeasure.config
       --dictfile option is set, --config option is set, 
       definitions come from dictfile and UMLS. If the associated term 
       for each CUI is defined in the dictfile, the associated terms' 
       definition are also included.  

Terms in the dictionary file use the delimiter : to seperate the terms and their definition. It allows multi terms in one concept. Please see the sample file at /sample/dictfile.

--doubledef option

This a dictionary file for the vector measure. It contains the 'definitons' of a concept which could be used in the relatedness computation. When this option is defined, for each unique word in the definition, it uses the word's definition in the doubledef file.

    For example, the original defintion for 'cat' is, 
    cat: a feline pet, feline 

    And then, the word vector for feline and pet in the doubledef file is: 
    feline: small to medium-sized cats, cougar cheetah
    pet: cat dog bird fish

    The final definition for cat is to combine the original definition for cat, and 
    then add the definition for feline(only add once) and pet. 

    cat: a feline pet small to medium-sized cats cougar cheetah cat dog bird fish

    For every unique word of the final definition, the doubledef finds the vector from the 
    co-occurrence matrix of each word and build the vector for cat.  

Terms in the --doubledef file use the delimiter : to seperate the terms and their definition. It has the same format with the dictfile. Please see the sample file at /sample/dictfile. We extract the definition from the WordNet by glossFinder. For the extraced file, we further parse each senses of the same word and obtain a complete definition of the word.

--compoundfile options

This is a compound word list for the vector or lesk measure. It defines the compound words which are treated as one word in the definitions. This must be used with the vector or lesk method. When use this option, the vectorindex and vectormatrix file must be generated by the corpus which also use the same compound words file.

    For example, the definition for iraq and france are: 

    iraq : saddam hussein
    france : jacques chirac

    In the --compoundfile file, "saddam hussein" and "jacques chirac" are compounds:

    jacques_chirac
    saddam_hussein

    So, the compound words in the definition could be detected:

    iraq : saddam_hussein
    france : jacques_chirac

The program searches the vectors for "saddam_hussein" and "jacques_chirac" in the vectorindex and vectormatrix file. The thing need to pay attention is the original text must be preprocessed by searching and replacing the compounds. find-compounds.pl in the Text-NSP package can help to do that. So, both the vectorindex and the vectormatrix files are built based on the the same compound words.

--config option

This is configure file for the lesk or vector measure. It defines the relationship, source and rela relationship. When compute the relatedness of a pair, umls-similarity.pl find the corresponding relationshps and source by the config file.

--stoplist option

This is a word list file for the vector measure. The words in the file should be removed from the definition. In the stop list file, each word is in the regular expression format. A stop word sample file is under the samples folder which is called stoplist-nsp.regex.

--stem option

This is a flag for the vector measure. If we the --stem flag is set, the words of the definition are stemmed by the the Porter Stemming algorithm. If this option is used, the original text should be stemmed too. Otherwise, the stemmed words cannot find the its corresponding index in the index file.

USAGE ^

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

For the getRelatednes() function, it accepts different combinations of CUIs and Terms. The following is the basic logic:

TYPICAL USAGE EXAMPLES ^

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

   use UMLS::Similarity::vector;
   $measure = UMLS::Similarity::vector->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.

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

CONFIGURATION OPTION ^

The UMLS-Interface package takes a configuration file to determine which sources and relations to use when obtaining the extended definitions. We call the definition used by the measure, the extended definition because this may include definitions from related concepts.

The format of the configuration file is as follows:

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

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

The possible relations that can be included in RELDEF are: 1. all of the possible relations in MRREL such as PAR, CHD, ... 2. CUI which refers the concepts definition 3. ST which refers to the concepts semantic types definition 4. TERM which refers to the concepts associated terms

For example, if we wanted to use the definitions from MSH vocabulary and we only wanted the definition of the CUI and the definitions of the CUIs SIB relation, the configuration file would be:

SABDEF :: include MSH RELDEF :: include CUI, SIB

Note: RELDEF takes any of MRREL relations and two special 'relations':

      1. CUI which refers to the CUIs definition

      2. TERM which refers to the terms associated with the CUI

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.

SEE ALSO ^

perl(1), UMLS::Interface

perl(1), UMLS::Similarity

CONTACT US ^

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

      umls-similarity@yahoogroups.com

  You can join this group by going to:

      http://tech.groups.yahoo.com/group/umls-similarity/

  You may also contact us directly if you prefer :

      Bridget T. McInnes: bthomson at cs.umn.edu 

      Ted Pedersen : tpederse at d.umn.edu

AUTHORS ^

  Bridget T McInnes <bthomson at cs.umn.edu>
  Siddharth Patwardhan <sidd at cs.utah.edu>
  Serguei Pakhomov <pakh0002 at umn.edu>
  Ted Pedersen <tpederse at d.umn.edu>
  Ying Liu <liux0935 at umn.edu> 

COPYRIGHT AND LICENSE ^

Copyright 2004-2011 by Bridget T McInnes, Siddharth Patwardhan, Serguei Pakhomov, Ying Liu 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: