public abstract class AbstractNameStandardizer extends IsCloseableObject implements NameStandardizer, UsesLogger
Modifier and Type | Field and Description |
---|---|
protected static TernaryTrie |
consonantTrie
Consonant trie.
|
protected Logger |
logger
Logger used for output.
|
protected static TernaryTrie |
nameTrie
Proper name trie.
|
Constructor and Description |
---|
AbstractNameStandardizer()
Create abstract name matcher.
|
Modifier and Type | Method and Description |
---|---|
boolean |
dontStandardize(java.lang.String properName)
Check if we should not standardize a name.
|
Logger |
getLogger()
Get the logger.
|
int |
getNumberOfNames()
Return number of names.
|
void |
loadNames(java.util.Collection<java.lang.String> properNamesCollection)
Load names from a collection of names.
|
void |
loadNames(java.lang.String lexiconFileName)
Load name data from lexicon file.
|
void |
loadNamesFromLexicon(Lexicon lexicon)
Load names from a lexicon.
|
java.lang.String |
preprocessProperName(java.lang.String properName)
Preprocess proper name.
|
void |
setLogger(Logger logger)
Set the logger.
|
java.lang.String |
standardizeProperName(java.lang.String properName)
Returns standardized proper name given a proper name.
|
close
protected static TernaryTrie nameTrie
protected static TernaryTrie consonantTrie
protected Logger logger
public AbstractNameStandardizer()
public void loadNames(java.lang.String lexiconFileName) throws java.io.IOException
loadNames
in interface NameStandardizer
lexiconFileName
- Lexicon containing name data.java.io.IOException
public void loadNamesFromLexicon(Lexicon lexicon) throws java.io.IOException
loadNamesFromLexicon
in interface NameStandardizer
lexicon
- The lexicon from which to load names.java.io.IOException
public void loadNames(java.util.Collection<java.lang.String> properNamesCollection)
loadNames
in interface NameStandardizer
properNamesCollection
- Collection containing proper names.public int getNumberOfNames()
getNumberOfNames
in interface NameStandardizer
public boolean dontStandardize(java.lang.String properName)
dontStandardize
in interface NameStandardizer
properName
- Name to check.Names that contain periods are not standardized by default.
public java.lang.String standardizeProperName(java.lang.String properName)
standardizeProperName
in interface NameStandardizer
properName
- The proper name.public java.lang.String preprocessProperName(java.lang.String properName)
preprocessProperName
in interface NameStandardizer
properName
- Proper name to preprocess.By default, no preprocessing is applied; the original proper name is returned unchanged.
public Logger getLogger()
getLogger
in interface UsesLogger
public void setLogger(Logger logger)
setLogger
in interface UsesLogger
logger
- The logger.