TC Java
2011 Version

gov.nih.nlm.nls.tc.FilterApi
Class LegalWords

java.lang.Object
  extended by gov.nih.nlm.nls.tc.FilterApi.LegalWords

public class LegalWords
extends java.lang.Object

This class is to detect a word is a legal word from files & algorithm. A legal word is define as follows:

History:

Version:
V-2011
Author:
NLM Lexical Systems Group
See Also:
Design Document

Constructor Summary
LegalWords(java.lang.String sFile, java.lang.String rFile, java.lang.String wFile)
          Initiate the LegalWords object by specifying files of stopwords and restrictwords.
LegalWords(java.lang.String sFile, java.lang.String rFile, java.lang.String wFile, boolean verbose)
          Initiate the LegalWords object by specifying files of stopwords and restrictwords.
 
Method Summary
 java.lang.String GetDebugMsg()
          Get the debug message
 java.util.HashSet<java.lang.String> GetRestrictWords()
          Get the collection object (in hash set) of restrictwords
 java.util.HashSet<java.lang.String> GetStopWords()
          Get the collection object (in hash set) of stopwords
 boolean IsLegalWord(java.lang.String word, boolean useMinLength, int minLength, boolean removeStopWord, boolean useRestrictWord, boolean useMinSignal, int minSignal, boolean useMaxSignal, int maxSignal, boolean useMinWc, int minWc, boolean useMinDc, int minDc)
          A method to detect if a word is a legal word by specifying all options.
 boolean IsLegalWord(java.lang.String word, LegalWordsOption option)
          A method to detect if a word is a legal word by specifying LegalWordsOption object.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegalWords

public LegalWords(java.lang.String sFile,
                  java.lang.String rFile,
                  java.lang.String wFile)
Initiate the LegalWords object by specifying files of stopwords and restrictwords.

Parameters:
sFile - file name for the stopwords
rFile - file name for the restrictwords
wFile - file name for the wordSignalWcDc

LegalWords

public LegalWords(java.lang.String sFile,
                  java.lang.String rFile,
                  java.lang.String wFile,
                  boolean verbose)
Initiate the LegalWords object by specifying files of stopwords and restrictwords.

Parameters:
sFile - file name for the stopwords
rFile - file name for the restrictwords
wFile - file name for the wordSignalWcDc
verbose - flag of verbose on reading input files
Method Detail

GetStopWords

public java.util.HashSet<java.lang.String> GetStopWords()
Get the collection object (in hash set) of stopwords

Returns:
a hashset of all stopwords

GetRestrictWords

public java.util.HashSet<java.lang.String> GetRestrictWords()
Get the collection object (in hash set) of restrictwords

Returns:
a hashset of all restrictwords

IsLegalWord

public boolean IsLegalWord(java.lang.String word,
                           LegalWordsOption option)
A method to detect if a word is a legal word by specifying LegalWordsOption object.

Parameters:
word - word to be tested

IsLegalWord

public boolean IsLegalWord(java.lang.String word,
                           boolean useMinLength,
                           int minLength,
                           boolean removeStopWord,
                           boolean useRestrictWord,
                           boolean useMinSignal,
                           int minSignal,
                           boolean useMaxSignal,
                           int maxSignal,
                           boolean useMinWc,
                           int minWc,
                           boolean useMinDc,
                           int minDc)
A method to detect if a word is a legal word by specifying all options.

Parameters:
word - word to be tested
useMinLength - boolean flag of using min. length
minLength - size of min. legnth
removeStopWord - boolean flag of using stopwords
useRestrictWord - boolean flag of using restrictwords
useMinSignal - boolean flag of using min. signal
minSignal - min. value of normalized signal
useMaxSignal - boolean flag of using max. signal
maxSignal - max. value of normalized signal
useMinWc - boolean flag of using min. word count
minWc - min. value of word count
useMinDc - boolean flag of using min. document count
minDc - min. value of document count
Returns:
true for legal word; false for not legal word;

GetDebugMsg

public java.lang.String GetDebugMsg()
Get the debug message

Returns:
debug message

main

public static void main(java.lang.String[] args)

TC Java
2011 Version

Submit a bug or feature

Copyright © 2011 National Library of Medicine