nrc.fuzzy
Class Modifiers

java.lang.Object
  |
  +--nrc.fuzzy.Modifiers
All Implemented Interfaces:
java.io.Serializable

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

This class maintains a list (in a hash table) of the fuzzy modifiers (or hedges) that are available to users. Modifiers manipulate a fuzzy value/fuzzy set returning a new fuzzy value/fuzzy set changed according to the modifier objectives. For example, the modifier 'very' squares each membership value in a fuzzy set.

Modifiers are also used in linguistic expressions when defining FuzzyValues. For example we might create the FuzzyValue:

    FuzzyValue fv = new FuzzyValue(tempFvar, "very hot");
  

Each individual fuzzy modifier is created as a subclass of the ModifierFunction class. If created according to the instructions provided these fuzzy modifer classes when Constructed will automatically call the Modifiers.add method to add themselves to the list of available modifiers. So the preferred way to add new modifiers is:

For convenience an instance of each of the built-in (system supplied) modifiers is created in the Modifiers class and a method is created for each one allowing them to be accessed in a simpler fashion: aModifiedFuzzyValue = Modifers.very(aFuzzyValue); NOTE: all modifier names are case insensitive ('very' is the same as 'VERY')

See Also:
ModifierFunction, Serialized Form

Constructor Summary
Modifiers()
           
 
Method Summary
static nrc.fuzzy.FuzzySet above(nrc.fuzzy.FuzzySet fs)
          Execute the 'above' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue above(nrc.fuzzy.FuzzyValue fv)
          Execute the 'above' modifier on a FuzzyValue
static void add(nrc.fuzzy.ModifierFunction mf)
          Adds a modifier function to the hashtable of modifiers.
static nrc.fuzzy.FuzzySet below(nrc.fuzzy.FuzzySet fs)
          Execute the 'below' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue below(nrc.fuzzy.FuzzyValue fv)
          Execute the 'below' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet call(java.lang.String modifierName, nrc.fuzzy.FuzzySet fs)
          Modify the FuzzySet specified using the ModifierFunction associated with the specified modifier name
static nrc.fuzzy.FuzzyValue call(java.lang.String modifierName, nrc.fuzzy.FuzzyValue fv)
          Modify the FuzzyValue specified using the ModifierFunction associated with the specified modifier name
static nrc.fuzzy.FuzzySet extremely(nrc.fuzzy.FuzzySet fs)
          Execute the 'extremely' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue extremely(nrc.fuzzy.FuzzyValue fv)
          Execute the 'extremely' modifier on a FuzzyValue
static java.lang.String[] getModifierNames()
          Retrieves the list of modifier names in an array.
static nrc.fuzzy.FuzzySet intensify(nrc.fuzzy.FuzzySet fs)
          Execute the 'intensify' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue intensify(nrc.fuzzy.FuzzyValue fv)
          Execute the 'intensify' modifier on a FuzzyValue
static boolean isModifier(java.lang.String modifierName)
          Checks to see if the specified modifier exists.
static nrc.fuzzy.FuzzySet more_or_less(nrc.fuzzy.FuzzySet fs)
          Execute the 'more_or_less' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue more_or_less(nrc.fuzzy.FuzzyValue fv)
          Execute the 'more_or_less' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet norm(nrc.fuzzy.FuzzySet fs)
          Execute the 'norm' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue norm(nrc.fuzzy.FuzzyValue fv)
          Execute the 'norm' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet not(nrc.fuzzy.FuzzySet fs)
          Execute the 'not' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue not(nrc.fuzzy.FuzzyValue fv)
          Execute the 'not' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet plus(nrc.fuzzy.FuzzySet fs)
          Execute the 'plus' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue plus(nrc.fuzzy.FuzzyValue fv)
          Execute the 'plus' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet slightly(nrc.fuzzy.FuzzySet fs)
          Execute the 'slightly' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue slightly(nrc.fuzzy.FuzzyValue fv)
          Execute the 'slightly' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet somewhat(nrc.fuzzy.FuzzySet fs)
          Execute the 'somewhat' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue somewhat(nrc.fuzzy.FuzzyValue fv)
          Execute the 'somewhat' modifier on a FuzzyValue
static nrc.fuzzy.FuzzySet very(nrc.fuzzy.FuzzySet fs)
          Execute the 'very' modifier on a FuzzySet
static nrc.fuzzy.FuzzyValue very(nrc.fuzzy.FuzzyValue fv)
          Execute the 'very' modifier on a FuzzyValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Modifiers

public Modifiers()
Method Detail

add

public static void add(nrc.fuzzy.ModifierFunction mf)
Adds a modifier function to the hashtable of modifiers. If the modifier name already exists it is replaced by this modifier function. NOTE: all modifier names are case insensitive ('very' is the same as 'VERY')

Parameters:
mf - the modifier function instance

isModifier

public static boolean isModifier(java.lang.String modifierName)
Checks to see if the specified modifier exists.

Parameters:
modifierName - the modifier name as a string
Returns:
true if the modifier is available, else false

getModifierNames

public static java.lang.String[] getModifierNames()
Retrieves the list of modifier names in an array.

Returns:
an array of strings with the names of the modifiers

call

public static nrc.fuzzy.FuzzyValue call(java.lang.String modifierName,
                                        nrc.fuzzy.FuzzyValue fv)
Modify the FuzzyValue specified using the ModifierFunction associated with the specified modifier name

Parameters:
modifierName - the modifier name as a string
Returns:
a FuzzyValue that holds the modified fuzzy set or null if the modifier function cannot be performed

call

public static nrc.fuzzy.FuzzySet call(java.lang.String modifierName,
                                      nrc.fuzzy.FuzzySet fs)
Modify the FuzzySet specified using the ModifierFunction associated with the specified modifier name

Parameters:
modifierName - the modifier name as a string
fs - the FuzzySet to modifiy
Returns:
a FuzzyValue that holds the modified fuzzy set or null if the modifier function cannot be performed

not

public static nrc.fuzzy.FuzzyValue not(nrc.fuzzy.FuzzyValue fv)
Execute the 'not' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
NotModifier

not

public static nrc.fuzzy.FuzzySet not(nrc.fuzzy.FuzzySet fs)
Execute the 'not' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
NotModifier

very

public static nrc.fuzzy.FuzzyValue very(nrc.fuzzy.FuzzyValue fv)
Execute the 'very' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
VeryModifier

very

public static nrc.fuzzy.FuzzySet very(nrc.fuzzy.FuzzySet fs)
Execute the 'very' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
VeryModifier

extremely

public static nrc.fuzzy.FuzzyValue extremely(nrc.fuzzy.FuzzyValue fv)
Execute the 'extremely' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
ExtremelyModifier

extremely

public static nrc.fuzzy.FuzzySet extremely(nrc.fuzzy.FuzzySet fs)
Execute the 'extremely' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
ExtremelyModifier

somewhat

public static nrc.fuzzy.FuzzyValue somewhat(nrc.fuzzy.FuzzyValue fv)
Execute the 'somewhat' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
SomewhatModifier

somewhat

public static nrc.fuzzy.FuzzySet somewhat(nrc.fuzzy.FuzzySet fs)
Execute the 'somewhat' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
SomewhatModifier

more_or_less

public static nrc.fuzzy.FuzzyValue more_or_less(nrc.fuzzy.FuzzyValue fv)
Execute the 'more_or_less' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
MoreorlessModifier

more_or_less

public static nrc.fuzzy.FuzzySet more_or_less(nrc.fuzzy.FuzzySet fs)
Execute the 'more_or_less' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
MoreorlessModifier

plus

public static nrc.fuzzy.FuzzyValue plus(nrc.fuzzy.FuzzyValue fv)
Execute the 'plus' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
PlusModifier

plus

public static nrc.fuzzy.FuzzySet plus(nrc.fuzzy.FuzzySet fs)
Execute the 'plus' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
PlusModifier

norm

public static nrc.fuzzy.FuzzyValue norm(nrc.fuzzy.FuzzyValue fv)
Execute the 'norm' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
NormModifier

norm

public static nrc.fuzzy.FuzzySet norm(nrc.fuzzy.FuzzySet fs)
Execute the 'norm' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
NormModifier

slightly

public static nrc.fuzzy.FuzzyValue slightly(nrc.fuzzy.FuzzyValue fv)
Execute the 'slightly' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
SlightlyModifier

slightly

public static nrc.fuzzy.FuzzySet slightly(nrc.fuzzy.FuzzySet fs)
Execute the 'slightly' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
SlightlyModifier

intensify

public static nrc.fuzzy.FuzzyValue intensify(nrc.fuzzy.FuzzyValue fv)
Execute the 'intensify' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
IntensifyModifier

intensify

public static nrc.fuzzy.FuzzySet intensify(nrc.fuzzy.FuzzySet fs)
Execute the 'intensify' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
IntensifyModifier

above

public static nrc.fuzzy.FuzzyValue above(nrc.fuzzy.FuzzyValue fv)
Execute the 'above' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
AboveModifier

above

public static nrc.fuzzy.FuzzySet above(nrc.fuzzy.FuzzySet fs)
Execute the 'above' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
AboveModifier

below

public static nrc.fuzzy.FuzzyValue below(nrc.fuzzy.FuzzyValue fv)
Execute the 'below' modifier on a FuzzyValue

Parameters:
fv - the fuzzy value to be modified
Returns:
the modified fuzzy value
See Also:
BelowModifier

below

public static nrc.fuzzy.FuzzySet below(nrc.fuzzy.FuzzySet fs)
Execute the 'below' modifier on a FuzzySet

Returns:
the modified fuzzy set
See Also:
BelowModifier