net.sf.jhunlang.jmorph
Class DictEntry

java.lang.Object
  extended bynet.sf.jhunlang.jmorph.DictEntry
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DummyEntry, ExceptionEntry, LanguageEntry, NameEntry, SwordEntry, XWordEntry

public class DictEntry
extends java.lang.Object
implements java.io.Serializable

DictEntry instances represent the dictionary definitions. The extensions XWordEntry and ExceptionEntry stand for exceptional words and the exceptional solutions resolving exceptional words respectively.

See Also:
Serialized Form

Field Summary
static byte ALL_CAPITALIZED
          Capitalization constant for all letters capital.
static byte ALL_LOWER
          Capitalization constant for all letters lower case.
protected  byte capitalization
          The capitalization of the word.
static byte CAPITALIZED
          Capitalization constant for first letter capital.
static java.lang.String[] CAPS
          Printable names for capitalization types.
protected  AffixFlags flags
          The affix flags admitted by this entry.
static byte FUNNY_CAPITALIZED
          Capitalization constant for funny capitalization.
protected  java.util.Collection homonyms
          The homonyms of this word.
protected  DictEntryExtension inflexion
          The inflexion of this word.
protected static java.util.Collection NO_HOMONYM
          Constant for the empty homonyms collection.
protected  DictEntry root
          The root of this entry.
protected  java.lang.String word
          The word of this entry.
 
Constructor Summary
DictEntry(java.lang.String word)
          Create a DictEntry for the word.
DictEntry(java.lang.String word, AffixFlags flags)
          Create a DictEntry for word with flags.
DictEntry(java.lang.String word, char[] flagCharacters)
          Create a DictEntry for word with flags specified by flagCharacters.
DictEntry(java.lang.String word, DictEntry root)
          Create a DictEntry for the word with root.
DictEntry(java.lang.String word, DictEntry root, AffixFlags flags)
          Create a DictEntry for word with flags and with root.
 
Method Summary
 boolean addHomonym(DictEntry h)
          Add homonym h if the addition doesn't result a cyclic reference via homonyms.
 boolean admitCapitalization(java.lang.String word)
          Return if the capitalization of this entry admits word.
 boolean admitLowerCapitalization(java.lang.String word)
          Return if the capitalization of this entry admits word with first character upper case.
static byte capitalization(java.lang.String word)
          Return the capitalization type of word.
 boolean compound()
          Tells if this entry represents a compound word.
 java.lang.String contentString()
          Return the internal String representation of the content of this entry.
 java.lang.String derivatorString()
           
 boolean derived()
          Tells if this entry represents a derived word.
 java.lang.String dictionaryDerivatorString()
          Return the derivator string showing how this entry is derived from the its dictionary root.
 boolean dictionaryWord()
          Tells if this entry has been read from the dictionary.
 DictEntry getAbsoluteRootEntry()
          Return the absolute root of this entry, the one at the bottom of the derivational chain.
 java.lang.String getAbsoluteRootWord()
          Return the absolute root of this entry, the one at the bottom of the derivational chain.
 AffixFlags getAccumulatedFlags()
          Accumulated flags stands for synthetizing multiple derivations using the affix rules of hunmorph RC1-2.
 byte getCapitalization()
          Return capitalization of the word of this entry.
 java.lang.String getCaseEnding()
          Return the case ending string of this entry.
 DictEntry getDictionaryRootEntry()
          Return the dictionary stem of word.
 java.lang.String getDictionaryRootWord()
          Return the dictionary stem of word.
 AffixFlags getFlags()
          Return flags
 java.lang.String getFlagString()
          Return the String representation of the affix flags
 java.util.Collection getHomonyms()
          Return collection of homonyms.
 DictEntryExtension getInflexion()
          Return inflexion.
 java.lang.String getPOS()
          Return the part-of-speech string of this entry as told by inflexion.
 DictEntry getRelativeRootEntry()
          Return the relative root, the root at the end of derivational chain of this entry.
 java.lang.String getRelativeRootWord()
          Return the word of the absolute root returned by getRelativeRootEntry().
 DictEntry getRootEntry()
          Return the root of this entry or null.
 java.lang.String getRootWord()
          Return the root word of this entry regardless if the root is inflexed.
 java.lang.String getWord()
          Return word of this entry.
 boolean hasFlag(AffixEntry entry)
          Return if flags contains the flag of entry.
 boolean hasFlag(int flag)
          Return if flags contains flag
 java.lang.String inflex(AffixEntry affix)
          Return the inflexed word resulted by applying affix to the word of this entry.
 java.lang.String inflex(PrefixEntry prefix, SuffixEntry suffix)
          Return the inflexed word resulted by applying prefix and suffix to the word of this entry.
 boolean inflexed()
          Return if this entry is an inflexed form of root.
 java.lang.String inflexionString()
           
 int length()
          Return the number of components of this entry.
 java.lang.String longContentString()
          Return the internal String representation of the content of this entry.
 java.lang.String morphString()
           
 void setInflexion(DictEntryExtension inflexion)
          Set inflexion.
 boolean setRoot(DictEntry entry)
          Set the root of this word if setting doesn't result a cyclic reference via roots.
protected  java.lang.String shortClassName()
           
 java.lang.String toLongString()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL_LOWER

public static final byte ALL_LOWER
Capitalization constant for all letters lower case.

See Also:
Constant Field Values

CAPITALIZED

public static final byte CAPITALIZED
Capitalization constant for first letter capital.

See Also:
Constant Field Values

ALL_CAPITALIZED

public static final byte ALL_CAPITALIZED
Capitalization constant for all letters capital.

See Also:
Constant Field Values

FUNNY_CAPITALIZED

public static final byte FUNNY_CAPITALIZED
Capitalization constant for funny capitalization.

See Also:
Constant Field Values

CAPS

public static final java.lang.String[] CAPS
Printable names for capitalization types.


NO_HOMONYM

protected static final java.util.Collection NO_HOMONYM
Constant for the empty homonyms collection.


flags

protected AffixFlags flags
The affix flags admitted by this entry.


word

protected java.lang.String word
The word of this entry.


capitalization

protected byte capitalization
The capitalization of the word.


root

protected DictEntry root
The root of this entry. Root is the immediate 'predecessor' of this entry.


homonyms

protected java.util.Collection homonyms
The homonyms of this word.


inflexion

protected DictEntryExtension inflexion
The inflexion of this word.

Constructor Detail

DictEntry

public DictEntry(java.lang.String word)
Create a DictEntry for the word.

Parameters:
word - the word
Throws:
java.lang.IllegalArgumentException - if the word is null

DictEntry

public DictEntry(java.lang.String word,
                 DictEntry root)
Create a DictEntry for the word with root.

Parameters:
word - the word
root - the root of the created entry
Throws:
java.lang.IllegalArgumentException - if the word is null

DictEntry

public DictEntry(java.lang.String word,
                 char[] flagCharacters)
Create a DictEntry for word with flags specified by flagCharacters.

Parameters:
word - the word
flagCharacters - the affix flags
Throws:
java.lang.IllegalArgumentException - if the word is null

DictEntry

public DictEntry(java.lang.String word,
                 AffixFlags flags)
Create a DictEntry for word with flags.

Parameters:
word - the word
flags - the affix flags
Throws:
java.lang.IllegalArgumentException - if the word is null

DictEntry

public DictEntry(java.lang.String word,
                 DictEntry root,
                 AffixFlags flags)
Create a DictEntry for word with flags and with root.

Parameters:
word - the word
flags - the affix flags
root - the root of the created entry
Throws:
java.lang.IllegalArgumentException - if the word is null
Method Detail

getWord

public java.lang.String getWord()
Return word of this entry.

Returns:
the word of this entry

getCapitalization

public byte getCapitalization()
Return capitalization of the word of this entry.

Returns:
the capitalization

getHomonyms

public java.util.Collection getHomonyms()
Return collection of homonyms.

Returns:
the homonyms of this word.

getFlags

public AffixFlags getFlags()
Return flags

Returns:
the flags of this entry

getFlagString

public java.lang.String getFlagString()
Return the String representation of the affix flags

Returns:
the String representation of the affix flags

getAccumulatedFlags

public AffixFlags getAccumulatedFlags()
Accumulated flags stands for synthetizing multiple derivations using the affix rules of hunmorph RC1-2. Accumulation goes along derivations until pos is unchanged.

Returns:
the flags accumulated along the 'pos-preserving' derivation path to this entry

getInflexion

public DictEntryExtension getInflexion()
Return inflexion.

Returns:
return inflexion

length

public int length()
Return the number of components of this entry. This implementation returns 1. Extensions representing compound words should override this method to return the true number of components.

Returns:
the number of component entries

compound

public boolean compound()
Tells if this entry represents a compound word. This implementation returns false. Extensions representing compound words should override this method to return true.

Returns:
if this entry represents a compound word.

dictionaryWord

public boolean dictionaryWord()
Tells if this entry has been read from the dictionary. Derivative extensions should override this method to return false.

Returns:
if this entry has been read from the dictionary file

derived

public boolean derived()
Tells if this entry represents a derived word. The implementation here returns false. Extensions should override this method to return the truth.

Returns:
if this entry represents a derived word.

inflexed

public boolean inflexed()
Return if this entry is an inflexed form of root.

Returns:
return if this entry is inflexed

getPOS

public java.lang.String getPOS()
Return the part-of-speech string of this entry as told by inflexion.

Returns:
part-of-speech of this entry

getCaseEnding

public java.lang.String getCaseEnding()
Return the case ending string of this entry. This implemenatation returns null. Extensions should override this method.

Returns:
case ending of this entry

getRootEntry

public DictEntry getRootEntry()
Return the root of this entry or null.

Returns:
the root of this entry if any

getRootWord

public java.lang.String getRootWord()
Return the root word of this entry regardless if the root is inflexed.

Returns:
the root word of this entry

getAbsoluteRootEntry

public DictEntry getAbsoluteRootEntry()
Return the absolute root of this entry, the one at the bottom of the derivational chain.

Returns:
the absolute root entry

getAbsoluteRootWord

public java.lang.String getAbsoluteRootWord()
Return the absolute root of this entry, the one at the bottom of the derivational chain.

Returns:
the absolute root word

getRelativeRootEntry

public DictEntry getRelativeRootEntry()
Return the relative root, the root at the end of derivational chain of this entry.

Returns:
the absolute root of this entry

getRelativeRootWord

public java.lang.String getRelativeRootWord()
Return the word of the absolute root returned by getRelativeRootEntry().

Returns:
the word of the absolute root of this entry

getDictionaryRootEntry

public DictEntry getDictionaryRootEntry()
Return the dictionary stem of word. Return getRelativeRootWord() if this entry has been read from a dictionary or root is null. Return dictionary stem of root otherwise.

Returns:
the dictionary stem of the word of this entry

getDictionaryRootWord

public java.lang.String getDictionaryRootWord()
Return the dictionary stem of word. Return getRelativeRootWord() if this entry has been read from a dictionary or root is null. Return dictionary stem of root otherwise.

Returns:
the dictionary stem of the word of this entry

setInflexion

public void setInflexion(DictEntryExtension inflexion)
Set inflexion.

Parameters:
inflexion - the inflexion to set

inflex

public java.lang.String inflex(AffixEntry affix)
Return the inflexed word resulted by applying affix to the word of this entry.

Parameters:
affix - the affix
Returns:
the inflexed word

inflex

public java.lang.String inflex(PrefixEntry prefix,
                               SuffixEntry suffix)
Return the inflexed word resulted by applying prefix and suffix to the word of this entry.

Parameters:
prefix - the prefix inflexion
suffix - the suffix inflexion
Returns:
the inflexed word

admitCapitalization

public boolean admitCapitalization(java.lang.String word)
Return if the capitalization of this entry admits word. Note that admitCaptialization does not check if word equals to the word of this entry!

Parameters:
word - the word to admit
Returns:
if the capitalization admits word

admitLowerCapitalization

public boolean admitLowerCapitalization(java.lang.String word)
Return if the capitalization of this entry admits word with first character upper case. Note that admitCaptialization does not check if word equals to the word of this entry!

Parameters:
word - the word to admit
Returns:
if the capitalization admits word

hasFlag

public boolean hasFlag(int flag)
Return if flags contains flag

Parameters:
flag - the flag to check
Returns:
if flags contains flag

hasFlag

public boolean hasFlag(AffixEntry entry)
Return if flags contains the flag of entry. The implementation of this method tells if flags contains the flag of entry.

Parameters:
entry - the affix entry to check
Returns:
if flags contains the flag of entry

setRoot

public boolean setRoot(DictEntry entry)
Set the root of this word if setting doesn't result a cyclic reference via roots.

Parameters:
entry - the root of this word.
Returns:
if root has been set

addHomonym

public final boolean addHomonym(DictEntry h)
Add homonym h if the addition doesn't result a cyclic reference via homonyms.

Parameters:
h - the homonym to add.
Returns:
if the homonym h has been added

morphString

public java.lang.String morphString()

derivatorString

public java.lang.String derivatorString()

inflexionString

public java.lang.String inflexionString()

dictionaryDerivatorString

public java.lang.String dictionaryDerivatorString()
Return the derivator string showing how this entry is derived from the its dictionary root.

Returns:
the derivator string from the dictionary root

longContentString

public java.lang.String longContentString()
Return the internal String representation of the content of this entry.

Returns:
the String representation of the of content of this entry

contentString

public java.lang.String contentString()
Return the internal String representation of the content of this entry.

Returns:
the String representation of the of content of this entry

toLongString

public java.lang.String toLongString()

toString

public java.lang.String toString()

shortClassName

protected java.lang.String shortClassName()

capitalization

public static byte capitalization(java.lang.String word)
Return the capitalization type of word. The returned value is one of ALL_LOWER, CAPITALIZED, ALL_CAPITALIZED and FUNNY_CAPITALIZED.

Parameters:
word - the word the capitalization of which is to be determined
Returns:
the captialization type of word.


Copyright © 2005 jmorph developers. All Rights Reserved.