org.apache.uima.conceptMapper.support.dictionaryResource
Class DictionaryResource_impl

java.lang.Object
  extended by org.apache.uima.conceptMapper.support.dictionaryResource.DictionaryResource_impl
All Implemented Interfaces:
DictionaryResource, org.apache.uima.resource.SharedResourceObject

public class DictionaryResource_impl
extends java.lang.Object
implements DictionaryResource, org.apache.uima.resource.SharedResourceObject

Implementation of a UIMA DictionaryResource


Nested Class Summary
static class DictionaryResource_impl.DictEntriesImpl
          Private class for storing first words in the dict hashtable.
static class DictionaryResource_impl.DictEntryImpl
           
 
Nested classes/interfaces inherited from interface org.apache.uima.conceptMapper.support.dictionaryResource.DictionaryResource
DictionaryResource.DictEntries, DictionaryResource.DictEntriesByLength, DictionaryResource.DictEntry
 
Field Summary
protected  java.util.Hashtable<java.lang.String,DictionaryResource.DictEntriesByLength> dictImpl
          Hashtable of first words.
protected  org.apache.uima.conceptMapper.support.dictionaryResource.DictionaryResource_impl.DictLoader dictLoader
          Dictionary file loader.
 int entryNum
           
protected  EntryPropertiesRoot entryPropertiesRoot
           
protected static int NumOfInitialDictEntries
          Initial size of dict
static java.lang.String PARAM_ATTRIBUTE_LIST
          Configuration parameter key/label for the attribute list
static java.lang.String PARAM_CASE_MATCH
          Configuration parameter key/label for the case matching string
static java.lang.String PARAM_DUMPDICT
          Configuration parameter key/label to indicate whether dictionary should be printed upon load
static java.lang.String PARAM_ORDERINDEPENDENTLOOKUP
          Configuration parameter key/label for the order independent lookup indicator
static java.lang.String PARAM_STEMMER_CLASS
          Configuration parameter key/label for the stemmer class spec.
static java.lang.String PARAM_STEMMER_DICT
          Configuration parameter key/label for the stemmer dictionary, passed into the stemmer's initialization method
static java.lang.String PARAM_XML_PARSER
           
 
Constructor Summary
DictionaryResource_impl()
           
DictionaryResource_impl(int initialDictEntries)
           
 
Method Summary
protected  java.lang.String convertEntities(java.lang.String input)
          Convert character entities in a string to the corresponding character.
 org.apache.uima.conceptMapper.support.dictionaryResource.DictionaryResource_impl.DictLoader getDictLoader()
           
 DictionaryResource.DictEntriesByLength getEntries(java.lang.String key)
          return data structure containing a list of dictionary entries, sorted by number of tokens
 EntryPropertiesRoot getEntryPropertiesRoot()
           
 boolean isLoaded()
           
 java.util.Enumeration<java.lang.String> keys()
           
 void load(org.apache.uima.resource.DataResource data)
           
 void loadDictionaryContents(org.apache.uima.analysis_engine.annotator.AnnotatorContext aContext, Logger logger, java.lang.String tokenAnnotationName, java.lang.String tokenTypeFeatureName, java.lang.String tokenClassFeatureName, java.lang.String tokenizerDescriptor)
           
 DictionaryResource newDictionaryResource(int initialDictEntries)
           
 void putEntry(java.lang.String key, java.lang.String[] elements, java.lang.String unsorted, int length, EntryProperties props)
          Create a new dictionary entry.
 void serializeEntries(java.io.FileOutputStream output)
           
 void setLoaded(boolean loaded)
           
static java.lang.String stringTogetherTokens(java.lang.String[] elements)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dictLoader

protected org.apache.uima.conceptMapper.support.dictionaryResource.DictionaryResource_impl.DictLoader dictLoader
Dictionary file loader. Uses an XML parser.


dictImpl

protected java.util.Hashtable<java.lang.String,DictionaryResource.DictEntriesByLength> dictImpl
Hashtable of first words. Contains a DictEntries object keyed on word string for the first word of every entry in the specified dictionary.


entryPropertiesRoot

protected EntryPropertiesRoot entryPropertiesRoot

NumOfInitialDictEntries

protected static final int NumOfInitialDictEntries
Initial size of dict

See Also:
Constant Field Values

PARAM_ORDERINDEPENDENTLOOKUP

public static final java.lang.String PARAM_ORDERINDEPENDENTLOOKUP
Configuration parameter key/label for the order independent lookup indicator

See Also:
Constant Field Values

PARAM_DUMPDICT

public static final java.lang.String PARAM_DUMPDICT
Configuration parameter key/label to indicate whether dictionary should be printed upon load

See Also:
Constant Field Values

PARAM_CASE_MATCH

public static final java.lang.String PARAM_CASE_MATCH
Configuration parameter key/label for the case matching string

See Also:
Constant Field Values

PARAM_STEMMER_CLASS

public static final java.lang.String PARAM_STEMMER_CLASS
Configuration parameter key/label for the stemmer class spec. If left out, no stemmer is used

See Also:
Constant Field Values

PARAM_STEMMER_DICT

public static final java.lang.String PARAM_STEMMER_DICT
Configuration parameter key/label for the stemmer dictionary, passed into the stemmer's initialization method

See Also:
Constant Field Values

PARAM_ATTRIBUTE_LIST

public static final java.lang.String PARAM_ATTRIBUTE_LIST
Configuration parameter key/label for the attribute list

See Also:
Constant Field Values

PARAM_XML_PARSER

public static final java.lang.String PARAM_XML_PARSER
See Also:
Constant Field Values

entryNum

public int entryNum
Constructor Detail

DictionaryResource_impl

public DictionaryResource_impl()

DictionaryResource_impl

public DictionaryResource_impl(int initialDictEntries)
Parameters:
initialDictEntries - Number of initial dictionary entries
Method Detail

getDictLoader

public org.apache.uima.conceptMapper.support.dictionaryResource.DictionaryResource_impl.DictLoader getDictLoader()
Returns:
Returns the dictLoader.

getEntries

public DictionaryResource.DictEntriesByLength getEntries(java.lang.String key)
Description copied from interface: DictionaryResource
return data structure containing a list of dictionary entries, sorted by number of tokens

Specified by:
getEntries in interface DictionaryResource
Returns:
data structure containing a list of dictionary entries, sorted by number of tokens

putEntry

public void putEntry(java.lang.String key,
                     java.lang.String[] elements,
                     java.lang.String unsorted,
                     int length,
                     EntryProperties props)
Create a new dictionary entry.

Specified by:
putEntry in interface DictionaryResource
Parameters:
key - the key to index on
elements - the individual elements to be entered in the dictionary
unsorted - an unsorted string representation of the entry, if the contents of 'elements' has been sorted
length - the number of words in the phrase (>=1)
props - the EntryProperties object for the dictionary entry

load

public void load(org.apache.uima.resource.DataResource data)
          throws org.apache.uima.resource.ResourceInitializationException
Specified by:
load in interface DictionaryResource
Specified by:
load in interface org.apache.uima.resource.SharedResourceObject
Throws:
org.apache.uima.resource.ResourceInitializationException

loadDictionaryContents

public void loadDictionaryContents(org.apache.uima.analysis_engine.annotator.AnnotatorContext aContext,
                                   Logger logger,
                                   java.lang.String tokenAnnotationName,
                                   java.lang.String tokenTypeFeatureName,
                                   java.lang.String tokenClassFeatureName,
                                   java.lang.String tokenizerDescriptor)
                            throws org.apache.uima.resource.ResourceInitializationException
Specified by:
loadDictionaryContents in interface DictionaryResource
Throws:
org.apache.uima.resource.ResourceInitializationException

isLoaded

public boolean isLoaded()
Specified by:
isLoaded in interface DictionaryResource
Returns:
Returns the loaded.

setLoaded

public void setLoaded(boolean loaded)
Parameters:
loaded - The loaded to set.

convertEntities

protected java.lang.String convertEntities(java.lang.String input)
Convert character entities in a string to the corresponding character. The set of entities handled includes:

Parameters:
input - the string to process.
Returns:
the string with converted entities

newDictionaryResource

public DictionaryResource newDictionaryResource(int initialDictEntries)
Specified by:
newDictionaryResource in interface DictionaryResource

keys

public java.util.Enumeration<java.lang.String> keys()
Specified by:
keys in interface DictionaryResource

stringTogetherTokens

public static java.lang.String stringTogetherTokens(java.lang.String[] elements)

toString

public java.lang.String toString()
Specified by:
toString in interface DictionaryResource
Overrides:
toString in class java.lang.Object

serializeEntries

public void serializeEntries(java.io.FileOutputStream output)
                      throws java.io.IOException
Throws:
java.io.IOException

getEntryPropertiesRoot

public EntryPropertiesRoot getEntryPropertiesRoot()
Specified by:
getEntryPropertiesRoot in interface DictionaryResource


Copyright © 2011. All Rights Reserved.