Because of a lapse in government funding, the information on this website may not be up to date, transactions submitted via the website may not be processed, and the agency may not be able to respond to inquiries until appropriations are enacted. The NIH Clinical Center (the research hospital of NIH) is open. For more details about its operating status, please visit cc.nih.gov. Updates regarding government operating status and resumption of normal operations can be found at OPM.gov.

Lexical Tools

SPT - Term Match Design

I. Introduction
This section describes the method used to find if a term exists in a Trie Tree.

II. Algorithm

  • Normalize the input term:
    • LowerCase
    • Add " $_END_STR" (the END node)
  • Tokenize normalized term into inWords as a Vector<String>
  • Set the curNode to ROOT node
  • Set findFlag = false
  • Go through the inWords
    • Initiate curWordNode by the curWord
    • get curChilds from curNode
    • Check if curChilds contains curWordNode
      • yes => Check if curWordNode is END NODE
        • yes => match, set findFlag = true, break
      • update curNode
      • no => not match (false), break

III. Java Classes & Method

  • TrieTreeMatch.java: a Java class for matching in TrieTree
  • public boolean Match(String inTerm)

IV. Examples

  • Synonym Rules:

    wordsynonym
    dogcanine
    catfeline
    canineK9
    K9bull dog
    Dog and catpets
    puppy and kittypets

  • Synonym Terms:

    Terms
    dog
    canine
    cat
    feline
    k9
    bull dog
    dog and cat
    pets
    puppy and kitty

  • Input Term:
    Dog and cat
    • Normalized: dog and cat $_END
    • Go through each word of "dog and cat $_END"
      icurWordNodecurNodecurChilds.contains(curWordNode)END_NODEfindFlag
      0dogROOTtruefalsefalse
      1anddogtruefalsefalse
      2catandtruefalsefalse
      3$_ENDcattruetruetrue

  • Output: True

  • Trie Tree