com.sun.labs.minion.lexmorph
Class LiteMorphRule

java.lang.Object
  extended by com.sun.labs.minion.lexmorph.LiteMorphRule

public class LiteMorphRule
extends java.lang.Object

A Rule typically matches a pattern at the right end of a word, removes some characters from the right end to produce a stem, and generates a list of alternative forms of the word by adding each of a specified list of alternative endings to the stem.

Each rule specifies a pattern and a list of modifications to be made to the input word to produce different variant forms of the word. The rule is represented as a string of pattern elements, separated by spaces, followed by a right arrow (" -> "), delimited by spaces, followed by a sequence of modification patterns, separated by commas, as in: ".aeiouy t + a -> as,ae,um,ums,on,ons,ic,ical", // (e.g., chordata, data, errata, sonata, toccata) In this case, the pattern element ".aeiouy" will match a vowel anywhere to the left of a "t" that is immediately to the left of a final "a", and it will remove the "a" from the end to produce a stem and then add each of the endings "as", "ae", "um", ... in turn to that stem to produce different variant forms of the word. The plus sign ("+") in this rule indicates that the rule is a suffix rule that is anchored to the right end of the word, with the "+" indicating the position where the suffix is to be removed from the word to form the stem. The dot (".") operator before the "aeiouy" indicates that one of these characters must be found somewhere in the word to the left of the "t". Pattern elements are matched right-to-left starting with the pattern element just to the left of the arrow (->) in the rule, with the matching usually starting with the rightmost letter of the word being analyzed. The different kinds of pattern elements that can occur are:

The modification entries in the right-hand side of a rule are typically sequences of characters to be appended as a suffixes to the stem that was determined by the pattern of the rule, However, there are various operators that can modify this behavior:

Rules are grouped in blocks and labeled (often by a common final letter sequence) and are ordered within each group so that after a matching rule is found no further rules are to be tried (except when invoked explicitly by a modification operator in an alternative modification in the right-hand side of the rule).

See Also:
LiteMorph

Field Summary
static boolean authorFlag
          The following static final boolean variable authorFlag is a flag for use by localization authors when developing morphological rules.
static boolean debugFlag
           
static boolean traceFlag
          For tracing the testing of LiteMorph rules.
static boolean traceMatchFlag
          For tracing behavior of rule matching.
 
Constructor Summary
LiteMorphRule(java.lang.String expression, java.lang.String ruleName, LiteMorph morph)
          Create a Rule
 
Method Summary
 java.lang.String[] getExpansions()
           
 java.util.Vector match(java.lang.String word, int depth, int skipnum)
          Determines if a word matches the rule
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

authorFlag

public static final boolean authorFlag
The following static final boolean variable authorFlag is a flag for use by localization authors when developing morphological rules. This flag will be set to false for a delivered run-time version, but can be set true when a morphological rule set is being developed. This flag is used to enable format checking and tracing that is important during rule development, but which is unnecessary in the run-time rule system, after the rule developer has used this facility to insure that the rules are well-formed. It is a static final variable so that the compiler will optimize the extra code away when the variable is false so that the run-time class files will be smaller. When authorFlag is false, all of the code associated with the tracing mechanism will automatically be eliminated by the compiler.

See Also:
Constant Field Values

debugFlag

public static boolean debugFlag

traceMatchFlag

public static boolean traceMatchFlag
For tracing behavior of rule matching.


traceFlag

public static boolean traceFlag
For tracing the testing of LiteMorph rules.

Constructor Detail

LiteMorphRule

public LiteMorphRule(java.lang.String expression,
                     java.lang.String ruleName,
                     LiteMorph morph)
Create a Rule

Parameters:
expression - A String representing the ending patern described previously.
ruleName - the name of the rule
morph - the LiteMorph to make morphological variants
Method Detail

getExpansions

public java.lang.String[] getExpansions()

match

public java.util.Vector match(java.lang.String word,
                              int depth,
                              int skipnum)
Determines if a word matches the rule


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object