hultig.sumo
Class Rule

java.lang.Object
  extended by hultig.sumo.Rule

public class Rule
extends Object

NOT YET WELL COMMENTED. This class a sentence reduction rule, obtained from Aleph, an Inductive Logic Programming (ILP) system.


Field Summary
static int ALL
           
 int COUNTER
          Used for calculating the frequency of rule applicability in a set of sentences (2012/01/05).
static int LEFT
           
static int MIDX
           
static int RIGHT
           
 
Constructor Summary
Rule()
          The default constructor.
Rule(int id, int cover, String sconditions)
          A constructor based on three parameters: the rule identification, the number of learning instances covered, and the string with the rule conditions.
 
Method Summary
 boolean entails(Rule r)
          Verify if a given rule is entailed by this rule.
 boolean equivalent(Rule r)
          Verifies whether two rules are equivalent, by comparing their conditions.
 String genPattern(int szmid)
          Pattern without chunks - it is a simpler version.
 String genPatternCHK(int szmid)
          Pattern without chunks - it is a simpler version.
 int getCover()
          Gives the support value for this rule, obtained from the induction process.
 int getID()
          An ID related to the one labeled by the Aleph system, during the induction process.
 String getPattern(int code)
          Gives the regular expression representing the conditions over a certain region, specified by code.
 String getStrConditions()
          The string conditions
 String getStrFOLogic()
           
static void main(String[] args)
          MAIN - For testing.
 boolean parseConditionString(String srule)
          Parses a string containing a sentence reduction rule.
 void set(int id, int cover, String sconditions)
          Defines the current instance upon three supplied instances.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static int ALL

LEFT

public static int LEFT

MIDX

public static int MIDX

RIGHT

public static int RIGHT

COUNTER

public int COUNTER
Used for calculating the frequency of rule applicability in a set of sentences (2012/01/05).

Constructor Detail

Rule

public Rule()
The default constructor.


Rule

public Rule(int id,
            int cover,
            String sconditions)
A constructor based on three parameters: the rule identification, the number of learning instances covered, and the string with the rule conditions.

Parameters:
id - The rule identifier.
cover - The rule coverage: number of positive learning instances covered.
sconditions - The string containing the conditions. It will be parsed, extracting their conditions.
Method Detail

set

public final void set(int id,
                      int cover,
                      String sconditions)
Defines the current instance upon three supplied instances. This method is invoked by the non-trivial constructor.

Parameters:
id - The rule identifier.
cover - The rule coverage: number of positive learning instances covered by this rule.
sconditions -

parseConditionString

public boolean parseConditionString(String srule)
Parses a string containing a sentence reduction rule. The rule conditions are identified and extracted. Internally, three regular expressions are generated, representing the conditions for the three rule main regions: left, middle, and right.

Parameters:
srule - The string holding a sentence reduction rule.
Returns:
The appropriate logical value: true on success.

genPattern

public String genPattern(int szmid)
Pattern without chunks - it is a simpler version. JPC 2009/04/26 19:51

Parameters:
szmid -
Returns:

genPatternCHK

public String genPatternCHK(int szmid)
Pattern without chunks - it is a simpler version. JPC 2009/04/27 19:50 PROVISÓRIO: Pensado para a permissa de existirem no máximo 3 literais, um para cada região. Isto deve ser uniformizado, no futuro.

Parameters:
szmid -
Returns:

entails

public boolean entails(Rule r)
Verify if a given rule is entailed by this rule. Here, the entailment mean that the given rule is more specific than this rule, i.e at least all literals from this rule are present in the set of literars, on the other rule.

Parameters:
r -
Returns:

equivalent

public boolean equivalent(Rule r)
Verifies whether two rules are equivalent, by comparing their conditions.

Parameters:
r - The other rule to compare with.
Returns:
The appropriate logical value.

getPattern

public String getPattern(int code)
Gives the regular expression representing the conditions over a certain region, specified by code. By default the whole pattern will be returned (
code = ALL
).

Parameters:
code - The region code: LEFT, MIDX, RIGHT or ALL
Returns:
The region pattern.

getCover

public int getCover()
Gives the support value for this rule, obtained from the induction process. That is, the number of positive learning instances from which this rule was learned.

Returns:
The coverage value, normally greater than zero.

getID

public int getID()
An ID related to the one labeled by the Aleph system, during the induction process.

Returns:

getStrConditions

public String getStrConditions()
The string conditions

Returns:
The string with the rule conditions, suplied to the constructor and used to shape this object. See the set/3 method.

getStrFOLogic

public String getStrFOLogic()

toString

public String toString()
Overrides:
toString in class Object

main

public static void main(String[] args)
MAIN - For testing.

Parameters:
args -