net.sf.jhunlang.jmorph
Class AffixEntry

java.lang.Object
  extended bynet.sf.jhunlang.jmorph.AffixEntry
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
PrefixEntry, SuffixEntry

public abstract class AffixEntry
extends java.lang.Object
implements java.io.Serializable

The common base class of PrefixEntry and SuffixEntry.

See Also:
Serialized Form

Field Summary
protected  int al
          Length of append
protected  java.lang.String append
          The characters to append to stripped stems
protected  java.lang.String caseEnding
           
protected  int cl
          Length of conditions
protected  Condition[] conditions
          Condition array of this entry without those for strip
protected  Conditions conds
          Conditions of this entry without those for strip
protected  int condsIndex
          Index of conds in Conditions
protected  java.lang.String contentString
          The String representation of this instance
protected  boolean crossable
          If this entry can be crossed
protected  AffixEntryExtension extension
          Stores future extension data (like description).
protected  int flag
          Flag of parent
protected  java.lang.String flagAndCaseString
           
protected  AffixFlags flags
          Stores crossable/derivation affix flags
protected  boolean ignoreCase
           
protected  int index
          Index of this entry at parent
protected  java.lang.String lowerCaseStrip
          The characters to strip from a stem before adding append
protected  Affix parent
          Parent of this entry
protected  int sl
          Length of strip.
protected  java.lang.String strip
          The characters to strip from a stem before adding append
protected  Condition[] stripConditions
          Condition array of this entry for strip
 
Constructor Summary
protected AffixEntry(Rules rules, Affix parent, int index, Condition[] acondition, java.lang.String strip, java.lang.String append)
          Create a new AffixEntry instance with the given parameters.
 
Method Summary
abstract  java.lang.String addLowerCaseStrip(java.lang.String word)
          Add strip all lowercase to word and return the resulted string.
abstract  java.lang.String addStrip(java.lang.String word)
          Add strip to word and return the resulted string.
 boolean admitStem(java.lang.CharSequence word)
          Return if word satisfies conditions.
 boolean admitStem(java.lang.CharSequence word, BooleanResults results)
          Return if word satisfies conditions.
abstract  java.lang.String append(java.lang.String word)
          Return the word by appending append word.
abstract  boolean check4Inflexion(java.lang.CharSequence word)
          Return if word satisfies stripConditions.
abstract  boolean checkStem(java.lang.CharSequence word)
          Return if word satisfies conditions.
 java.lang.String contentString()
          Return the String representation of this entry.
 boolean crossable()
          Return if this entry can be crossed.
 DictEntry derive(java.lang.String word, DictEntry root)
          Create and return a DictEntry instance for derivation of word by this entry.
 java.lang.String getAppend()
          Return the string this entry appends/prepends to stems.
abstract  char getAppendCharAt(int i)
           
 java.lang.String getCase()
           
 java.lang.String getCaseEnding()
           
protected  java.lang.String getClassNameString()
           
 AffixEntryExtension getExtension()
          Return the extension of this entry.
 int getFlag()
          Return the flag (the caracter identifier) of this entry.
 java.lang.String getFlagAndCaseString()
           
 AffixFlags getFlags()
          Return flags of this entry.
 int getIndex()
          Return the index of this entry in its parent Affix.
 Affix getParent()
          Return the parent Affix of this entry.
 java.lang.String getStrip()
          Return the string this entry strips off from stems before appending.
 int getStripLength()
          Return the length of strip.
 boolean hasFlag(int flag)
          Return if flags contains flag.
 boolean ignoreCase()
           
 java.lang.String inflex(java.lang.String word)
          Return the word by stripping strip from and appending append to word.
 java.lang.String longContentString()
          Return the String representation of this entry.
 java.lang.String morphString()
           
 int rawConditionLength()
          Return length of conditions.
abstract  java.lang.String reverse(java.lang.String word)
          Return the word by stripping append from and appending strip to word.
 boolean same()
          Return if inflexing with this affix gives back the word itself i.e.
 void setExtension(AffixEntryExtension extension)
           
 void setFlags(char[] flagCharacters)
          Set the flags of this entry.
 void setIgnoreCase(boolean ignoreCase)
           
abstract  java.lang.String strip(java.lang.String word)
          Strip off strip from word.
 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

parent

protected Affix parent
Parent of this entry


index

protected int index
Index of this entry at parent


flag

protected int flag
Flag of parent


conds

protected Conditions conds
Conditions of this entry without those for strip


condsIndex

protected int condsIndex
Index of conds in Conditions


conditions

protected Condition[] conditions
Condition array of this entry without those for strip


cl

protected int cl
Length of conditions


stripConditions

protected Condition[] stripConditions
Condition array of this entry for strip


crossable

protected boolean crossable
If this entry can be crossed


ignoreCase

protected boolean ignoreCase

caseEnding

protected java.lang.String caseEnding

flagAndCaseString

protected java.lang.String flagAndCaseString

strip

protected java.lang.String strip
The characters to strip from a stem before adding append


lowerCaseStrip

protected java.lang.String lowerCaseStrip
The characters to strip from a stem before adding append


sl

protected int sl
Length of strip. sl is the length of stripConditions as well.


append

protected java.lang.String append
The characters to append to stripped stems


al

protected int al
Length of append


flags

protected AffixFlags flags
Stores crossable/derivation affix flags


extension

protected AffixEntryExtension extension
Stores future extension data (like description).


contentString

protected transient java.lang.String contentString
The String representation of this instance

Constructor Detail

AffixEntry

protected AffixEntry(Rules rules,
                     Affix parent,
                     int index,
                     Condition[] acondition,
                     java.lang.String strip,
                     java.lang.String append)
Create a new AffixEntry instance with the given parameters. None of strip and append can be null.

Parameters:
rules - the rules this affix belongs to
parent - the Affix parent
index - the index of this entry at its parent (informal)
acondition - the conditions of this entry
strip - the characters to strip from stems before adding append
append - the characters to append to stripped stems throws IllegalArgumentException if either strip or append is null or strip doesn't satisfy the conditions
Method Detail

same

public boolean same()
Return if inflexing with this affix gives back the word itself i.e. if strip is append.

Returns:
if inflexing with this affix gives back the word itself

getStripLength

public int getStripLength()
Return the length of strip.

Returns:
the length of strip

derive

public DictEntry derive(java.lang.String word,
                        DictEntry root)
Create and return a DictEntry instance for derivation of word by this entry. If extension is not null then call its derive method, otherwise create DictEntry for word with root and flags.

Parameters:
word - the derived word
root - the root of the derivatoin
Returns:
a DictEntry representing word as derived from root by this entry

getCaseEnding

public java.lang.String getCaseEnding()

getCase

public java.lang.String getCase()

crossable

public boolean crossable()
Return if this entry can be crossed.

Returns:
if this affix can crossed with other crossable affixes

getParent

public Affix getParent()
Return the parent Affix of this entry.

Returns:
the parent of this entry

getAppend

public java.lang.String getAppend()
Return the string this entry appends/prepends to stems.

Returns:
the string this entry appends/prepends to stems

getStrip

public java.lang.String getStrip()
Return the string this entry strips off from stems before appending.

Returns:
the strip of this entry

getIndex

public int getIndex()
Return the index of this entry in its parent Affix.

Returns:
the index of this entry in its parent

getFlag

public int getFlag()
Return the flag (the caracter identifier) of this entry.

Returns:
the flag of this entry

rawConditionLength

public int rawConditionLength()
Return length of conditions.

Returns:
the length of conditions without those for strip

admitStem

public boolean admitStem(java.lang.CharSequence word)
Return if word satisfies conditions. Calls checkStem(java.lang.CharSequence).

Parameters:
word - the word to check
Returns:
if word satisfies the conditions

admitStem

public boolean admitStem(java.lang.CharSequence word,
                         BooleanResults results)
Return if word satisfies conditions. This method uses the result caching mechanism of Conditions by calling checkStem(java.lang.CharSequence) only if the cached result in results is invalid.

Parameters:
word - the word to check
Returns:
if word satisfies the conditions

setFlags

public void setFlags(char[] flagCharacters)
Set the flags of this entry.

Parameters:
flagCharacters - the flag characters to set

getFlags

public AffixFlags getFlags()
Return flags of this entry.

Returns:
flags of this entry.

getFlagAndCaseString

public java.lang.String getFlagAndCaseString()

setExtension

public void setExtension(AffixEntryExtension extension)

getExtension

public AffixEntryExtension getExtension()
Return the extension of this entry.

Returns:
the extension of this entry

ignoreCase

public boolean ignoreCase()
Returns:
return ignoreCase.

setIgnoreCase

public void setIgnoreCase(boolean ignoreCase)
Parameters:
ignoreCase - the ignoreCase to set.

hasFlag

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

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

checkStem

public abstract boolean checkStem(java.lang.CharSequence word)
Return if word satisfies conditions.

Parameters:
word - the word to check
Returns:
if the word satisfies the conditions

check4Inflexion

public abstract boolean check4Inflexion(java.lang.CharSequence word)
Return if word satisfies stripConditions.

Parameters:
word - the word to check
Returns:
if the word satisfies the stripConditions

addStrip

public abstract java.lang.String addStrip(java.lang.String word)
Add strip to word and return the resulted string.

Parameters:
word - the word strip to be added to
Returns:
the string resulted by adding strip to word

addLowerCaseStrip

public abstract java.lang.String addLowerCaseStrip(java.lang.String word)
Add strip all lowercase to word and return the resulted string.

Parameters:
word - the word strip to be added to
Returns:
the string resulted by adding lower case strip to word

strip

public abstract java.lang.String strip(java.lang.String word)
Strip off strip from word.

Parameters:
word - the word to strip
Returns:
the stripped word

append

public abstract java.lang.String append(java.lang.String word)
Return the word by appending append word.

Parameters:
word - the word append to be added to
Returns:
the extended word

reverse

public abstract java.lang.String reverse(java.lang.String word)
Return the word by stripping append from and appending strip to word.

Parameters:
word - the word to reverse
Returns:
the reversed word

getAppendCharAt

public abstract char getAppendCharAt(int i)

inflex

public final java.lang.String inflex(java.lang.String word)
Return the word by stripping strip from and appending append to word.

Parameters:
word - the word to inflex
Returns:
the inflexed word

morphString

public java.lang.String morphString()

longContentString

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

Returns:
the String representation of this entry

contentString

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

Returns:
the String representation of this entry

getClassNameString

protected java.lang.String getClassNameString()

toLongString

public java.lang.String toLongString()

toString

public java.lang.String toString()


Copyright © 2005 jmorph developers. All Rights Reserved.