org.LexGrid.LexBIG.example
Class MetaMatch

java.lang.Object
  extended by org.LexGrid.LexBIG.example.MetaMatch

public class MetaMatch
extends java.lang.Object

Example attempting to approximate some characteristics of the Metaphrase search algorithm. However, full Metaphrase compatibility is not anticipated.


Constructor Summary
MetaMatch()
          Default constructor.
 
Method Summary
protected  float getReferenceWeight(ResolvedConceptReference ref, java.util.List<java.lang.String> matchWords)
          Return a relative weight between 0 and 1 that indicates how well the given reference maps to a set of words.
protected  float getTextWeight(java.lang.String text, java.util.List<java.lang.String> matchWords)
          Return a relative weight between 0 and 1 that indicates how well the given string maps to a set of words.
static void main(java.lang.String[] args)
          Entry point for processing.
protected  void matchSpell(java.lang.String s, LexBIGService lbSvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt)
          Attempt to approximate spelling suggestions.
protected  void matchSubquery(java.lang.String s, LexBIGService lbSvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt)
          Attempt to approximate compositional or sub-query match (e.g., "peptic ulcer" will match the two separate entries for "peptic" and "ulcer", in case the ontology does not contain any entry matching the full text "peptic ulcer").
protected  void matchSynonyms(java.lang.String s, LexBIGService lbSvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt)
          Display concepts and related text strings matching the given string.
protected  void matchTermCompletion(java.lang.String s, LexBIGService lbSvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt)
          Attempt to approximate term completion.
protected  void matchWordCompletion(java.lang.String s, LexBIGService lbSvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt)
          Attempt to approximate word completion.
protected  void printText(ResolvedConceptReference ref)
          Print code and text for all text presentations associated with the given node reference.
protected  void printText(ResolvedConceptReference ref, boolean removeStopWords, java.lang.String prefix, int wordCount)
          Print code and text for all text presentations associated with the given concept reference.
protected  void printText(ResolvedConceptReference ref, java.lang.String[] matchWords, int matchOption)
          Print code and text for all text presentations associated with the given concept reference.
 void run(java.lang.String s)
           
protected  java.lang.String[] toWords(java.lang.String s, boolean removeStopWords)
          Returns an array containing the individual white-space delimited words contained by the given string, normalizing to lowercase and optionally removing stop words.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaMatch

public MetaMatch()
Default constructor.

Method Detail

main

public static void main(java.lang.String[] args)
Entry point for processing.

Parameters:
args -

run

public void run(java.lang.String s)
         throws LBException
Throws:
LBException

matchSynonyms

protected void matchSynonyms(java.lang.String s,
                             LexBIGService lbSvc,
                             java.lang.String scheme,
                             CodingSchemeVersionOrTag csvt)
                      throws LBException
Display concepts and related text strings matching the given string.

Parameters:
s - The test string.
lbSvc -
scheme -
csvt -
Throws:
LBException

matchSpell

protected void matchSpell(java.lang.String s,
                          LexBIGService lbSvc,
                          java.lang.String scheme,
                          CodingSchemeVersionOrTag csvt)
                   throws LBException
Attempt to approximate spelling suggestions.

Parameters:
s - The test string.
lbSvc -
scheme -
csvt -
Throws:
LBException

matchTermCompletion

protected void matchTermCompletion(java.lang.String s,
                                   LexBIGService lbSvc,
                                   java.lang.String scheme,
                                   CodingSchemeVersionOrTag csvt)
                            throws LBException
Attempt to approximate term completion.

Parameters:
s - The test string.
lbSvc -
scheme -
csvt -
Throws:
LBException

matchWordCompletion

protected void matchWordCompletion(java.lang.String s,
                                   LexBIGService lbSvc,
                                   java.lang.String scheme,
                                   CodingSchemeVersionOrTag csvt)
                            throws LBException
Attempt to approximate word completion.

Parameters:
s - The test string.
lbSvc -
scheme -
csvt -
Throws:
LBException

matchSubquery

protected void matchSubquery(java.lang.String s,
                             LexBIGService lbSvc,
                             java.lang.String scheme,
                             CodingSchemeVersionOrTag csvt)
                      throws LBException
Attempt to approximate compositional or sub-query match (e.g., "peptic ulcer" will match the two separate entries for "peptic" and "ulcer", in case the ontology does not contain any entry matching the full text "peptic ulcer").

Parameters:
s - The test string.
lbSvc -
scheme -
csvt -
Throws:
LBException

getReferenceWeight

protected float getReferenceWeight(ResolvedConceptReference ref,
                                   java.util.List<java.lang.String> matchWords)
Return a relative weight between 0 and 1 that indicates how well the given reference maps to a set of words.

Parameters:
ref -
matchWords -
Returns:

getTextWeight

protected float getTextWeight(java.lang.String text,
                              java.util.List<java.lang.String> matchWords)
Return a relative weight between 0 and 1 that indicates how well the given string maps to a set of words.

Parameters:
ref -
matchWords -
Returns:

printText

protected void printText(ResolvedConceptReference ref)
Print code and text for all text presentations associated with the given node reference.

Parameters:
ref -

printText

protected void printText(ResolvedConceptReference ref,
                         boolean removeStopWords,
                         java.lang.String prefix,
                         int wordCount)
Print code and text for all text presentations associated with the given concept reference. If specified, any printed terms will have stop words removed prior to comparison, must include the given prefix, and can be constrained to those with a set number of words.

Parameters:
ref -
removeStopWords -
prefix -
wordCount -

printText

protected void printText(ResolvedConceptReference ref,
                         java.lang.String[] matchWords,
                         int matchOption)
Print code and text for all text presentations associated with the given concept reference. If specified, the given words are compared against each printed presentation according to the chosen match option. Match option of 1 indicates to match at least one word; match option of 2 indicates a presentation must match all words.

Parameters:
ref -
matchWords -
matchOption -

toWords

protected java.lang.String[] toWords(java.lang.String s,
                                     boolean removeStopWords)
Returns an array containing the individual white-space delimited words contained by the given string, normalizing to lowercase and optionally removing stop words.

Parameters:
s -
removeStopWords -
Returns:

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.