|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.LexGrid.LexBIG.example.ScoreTerm
public class ScoreTerm
Example showing a simple scoring algorithm that evaluates a provided term against available terms in a code system. A cutoff percentage can optionally be provided.
Nested Class Summary | |
---|---|
protected class |
ScoreTerm.ScoredTerm
|
Constructor Summary | |
---|---|
ScoreTerm()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Program entry point. |
protected void |
printReport(org.apache.commons.collections.BidiMap result)
Display results to the user. |
protected ResolvedConceptReferencesIterator |
resolveConcepts(CodingSchemeSummary css,
java.lang.String query)
Resolves matching concepts for any word in the given term. |
void |
run(java.lang.String term,
float minScore)
Runs the score algorithm for a specific term. |
protected float |
score(java.util.SortedSet wordsToCompare,
java.util.SortedSet wordsToCompareAgainst)
Returns a score providing a relative comparison of the first set of words against the second. |
protected java.util.SortedSet |
toWords(java.lang.String s)
Return the words comprising the given string, in order ignoring duplicates, common separators and punctuation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScoreTerm()
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- String[]public void run(java.lang.String term, float minScore) throws java.lang.Exception
term
- The text to evaluate.score
- Lower cutoff (percentage); a value less than or equal to 0
indicates no cutoff.
java.lang.Exception
protected ResolvedConceptReferencesIterator resolveConcepts(CodingSchemeSummary css, java.lang.String query) throws LBException
css
- The code system to search.matchWords
- The term to match.
LBException
protected float score(java.util.SortedSet wordsToCompare, java.util.SortedSet wordsToCompareAgainst)
Currently the score is evaluated as a simple percentage based on number of words in the first set that are also in the second (order independent). This could be enhanced to take order into account, etc.
wordsToCompare
- wordsToCompareAgainst
-
protected void printReport(org.apache.commons.collections.BidiMap result)
result
- protected java.util.SortedSet toWords(java.lang.String s)
s
-
|
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. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |