Пример #1
0
 /**
  * Add an inflectional variant to this word element. This method is intended
  * for use by a <code>Lexicon</code>. The idea is that words which have more
  * than one inflectional variant (for example, a regular and an irregular
  * form of the past tense), can have a default variant (for example, the
  * regular), but also store information about the other variants. This comes
  * in useful in case the default inflectional variant is reset to a new one.
  * In that case, the stored forms for the new variant are used to inflect
  * the word.
  *
  * <P>
  * <strong>An example:</strong> The verb <i>lie</i> has both a regular form
  * (<I>lies, lied, lying</I>) and an irregular form (<I>lay, lain,</I> etc).
  * Assume that the <code>Lexicon</code> provides this information and treats
  * this as variant information of the same word (as does the
  * <code>NIHDBLexicon</code>, for example). Typically, the default
  * inflectional variant is the <code>Inflection.REGULAR</code>. This means
  * that morphology proceeds to inflect the verb as <I>lies, lying</I> and so
  * on. If the default inflectional variant is reset to
  * <code>Inflection.IRREGULAR</code>, the stored irregular forms will be
  * used instead.
  *
  * @param infl
  *            the Inflection pattern with which this form is associated
  * @param lexicalFeature
  *            the actual inflectional feature being set, for example
  *            <code>LexicalFeature.PRESENT_3S</code>
  * @param form
  *            the actual inflected word form
  */
 public virtual void addInflectionalVariant(Inflection infl, string lexicalFeature, string form)
 {
     if (inflVars.ContainsKey(infl))
     {
         inflVars[infl].addForm(lexicalFeature, form);
     }
     else
     {
         InflectionSet set = new InflectionSet(this, infl);
         set.addForm(lexicalFeature, form);
         inflVars[infl] = set;
     }
 }
Пример #2
0
        /**
         * Set the default inflectional variant of a word. This is mostly relevant
         * if the word has more than one possible inflectional variant (for example,
         * it can be inflected in both a regular and irregular way).
         *
         * <P>
         * If the default inflectional variant is set, the inflectional forms of the
         * word may change as a result. This depends on whether inflectional forms
         * have been specifically associated with this variant, via
         * {@link #addInflectionalVariant(Inflection, String, String)}.
         *
         * <P>
         * The <code>NIHDBLexicon</code> associates different inflectional variants
         * with words, if they are so specified, and adds the correct forms.
         *
         * @param variant
         *            The variant
         */
        public virtual void setDefaultInflectionalVariant(Inflection variant)
        {
            setFeature(LexicalFeature.DEFAULT_INFL, variant);
            defaultInfl = variant;

            if (inflVars.ContainsKey(variant))
            {
                InflectionSet set   = inflVars[variant];
                string[]      forms = LexicalFeature.getInflectionalFeatures(Category);

                if (forms != null)
                {
                    foreach (string f in forms)
                    {
                        setFeature(f, set.getForm(f));
                    }
                }
            }
        }
Пример #3
0
 /**
  * Specify that this word has an inflectional variant (e.g. irregular)
  *
  * @param infl
  *            the variant
  */
 public virtual void addInflectionalVariant(Inflection infl)
 {
     inflVars[infl] = new InflectionSet(this, infl);
 }