Package net.didion.jwnl.dictionary.morph
Class DefaultMorphologicalProcessor
- java.lang.Object
-
- net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor
-
- All Implemented Interfaces:
MorphologicalProcessor
,Createable
public class DefaultMorphologicalProcessor extends java.lang.Object implements MorphologicalProcessor
Default implementation ofMorphologicalProcessor
. This isn't a true morpological analyzer (it doesn't figure out all the characteristics of each word it processes). This is basically a stemmer that uses WordNet exception files instead of complex stemming rules. It also tries to be intelligent by removing delimiters and doing concatanation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DefaultMorphologicalProcessor.LookupInfo
-
Field Summary
Fields Modifier and Type Field Description private Cache
_lookupCache
private Operation[]
_operations
static java.lang.String
CACHE_CAPACITY
Parameter that determines the size of the base form cacheprivate static int
DEFAULT_CACHE_CAPACITY
static java.lang.String
OPERATIONS
Parameter that determines the operations this morphological processor will perform
-
Constructor Summary
Constructors Constructor Description DefaultMorphologicalProcessor()
DefaultMorphologicalProcessor(Operation[] operations)
DefaultMorphologicalProcessor(Operation[] operations, int cacheCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
cacheLookupInfo(POSKey key, DefaultMorphologicalProcessor.LookupInfo info)
java.lang.Object
create(java.util.Map params)
private DefaultMorphologicalProcessor.LookupInfo
getCachedLookupInfo(POSKey key)
java.util.List
lookupAllBaseForms(POS pos, java.lang.String derivation)
Return all the base forms of derivationIndexWord
lookupBaseForm(POS pos, java.lang.String derivation)
Lookup the base form of a word.private IndexWord
lookupNextBaseForm(POS pos, java.lang.String derivation, DefaultMorphologicalProcessor.LookupInfo info)
Lookup the next base form of a pos/word pair.
-
-
-
Field Detail
-
CACHE_CAPACITY
public static final java.lang.String CACHE_CAPACITY
Parameter that determines the size of the base form cache- See Also:
- Constant Field Values
-
OPERATIONS
public static final java.lang.String OPERATIONS
Parameter that determines the operations this morphological processor will perform- See Also:
- Constant Field Values
-
DEFAULT_CACHE_CAPACITY
private static final int DEFAULT_CACHE_CAPACITY
- See Also:
- Constant Field Values
-
_lookupCache
private Cache _lookupCache
-
_operations
private Operation[] _operations
-
-
Method Detail
-
create
public java.lang.Object create(java.util.Map params) throws JWNLException
- Specified by:
create
in interfaceCreateable
- Throws:
JWNLException
-
lookupBaseForm
public IndexWord lookupBaseForm(POS pos, java.lang.String derivation) throws JWNLException
Lookup the base form of a word. Given a lemma, finds the WordNet entry most like that lemma. This function returns the first base form found. Subsequent calls to this function with the same part-of-speech and word will return the same base form. To find another base form for the pos/word, call lookupNextBaseForm.- Specified by:
lookupBaseForm
in interfaceMorphologicalProcessor
- Parameters:
pos
- the part-of-speech of the word to look upderivation
- the word to look up- Returns:
- IndexWord the IndexWord found during lookup
- Throws:
JWNLException
-
cacheLookupInfo
private void cacheLookupInfo(POSKey key, DefaultMorphologicalProcessor.LookupInfo info)
-
getCachedLookupInfo
private DefaultMorphologicalProcessor.LookupInfo getCachedLookupInfo(POSKey key)
-
lookupNextBaseForm
private IndexWord lookupNextBaseForm(POS pos, java.lang.String derivation, DefaultMorphologicalProcessor.LookupInfo info) throws JWNLException
Lookup the next base form of a pos/word pair. If a base form has not yet been found for the pos/word, it will find the first base form, otherwise it will find the next base form.- Parameters:
pos
- the part-of-speech of the word to look upderivation
- the word to look up- Returns:
- IndexWord the IndexWord found during lookup, or null if an IndexWord is not found
- Throws:
JWNLException
-
lookupAllBaseForms
public java.util.List lookupAllBaseForms(POS pos, java.lang.String derivation) throws JWNLException
Description copied from interface:MorphologicalProcessor
Return all the base forms of derivation- Specified by:
lookupAllBaseForms
in interfaceMorphologicalProcessor
- Throws:
JWNLException
-
-