ilog.rules.vocabulary.verbalization

Class IlrDefaultTermBuilder

  • java.lang.Object
    • ilog.rules.vocabulary.verbalization.IlrDefaultTermBuilder
  • All Implemented Interfaces:
    IlrTermBuilder


    public class IlrDefaultTermBuilder
    extends java.lang.Object
    implements IlrTermBuilder
    This class defines the default behavior for a term builder, used by IlrDefaultVerbalizer. It is used to produce terms for concepts and roles when the vocabulary is generated.

    This class can be sub-classes when a language requires a more specific algorithm for producing terms from BOM class or BOM members.

    Since:
    JRules 6.1
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      IlrTerm getTerm(java.lang.String source, java.lang.String alternateSource, boolean isPlural)
      By default, this method removes known suffixes and prefixes, detach words from upper case characters, and put lower case characters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IlrDefaultTermBuilder

        public IlrDefaultTermBuilder()
    • Method Detail

      • getTerm

        public IlrTerm getTerm(java.lang.String source,
                      java.lang.String alternateSource,
                      boolean isPlural)
        By default, this method removes known suffixes and prefixes, detach words from upper case characters, and put lower case characters. For example, if a BOM method "displayCustomerAge" is verbalized, then the method name is passed through this method and is transformed as "display customer age". The prefixes removed by this method are the following:
        • is. For example "isRich" becomes "rich".
        • get. For example "getValue" becomes "value".
        • set. For example "setValue" becomes "setValue".
        • add. For example "addItem" becomes "item".
        • remove. For example "removeItem" becomes "item".
        and if the source correspond to a plural (isPlural == true), it removes the following suffixes:
        • s. For example "items" becomes "item", unless the word ends with two 's' (like in "address").
        • List. For example "itemList" becomes "item."
        The resulting words are used as a label for the returned IlrTerm instance.
        Specified by:
        getTerm in interface IlrTermBuilder
        Parameters:
        source - The source string.
        isPlural - Indicates if the source string is considered as a plural form.
        alternateSource - An alternate source string. This string can be used as source in some rare cases where the main source string is not sufficient to build a term. It is usually the type of a unique parameter from a BOM method. It could also be null.
        Returns:
        A new instance of IlrTerm.

© Copyright IBM Corp. 1987, 2017