standup.joke
Class InstantiationConstraintFamiliarityScore

java.lang.Object
  extended by standup.joke.InstantiationConstraintFamiliarityScore
All Implemented Interfaces:
InstantiationConstraint, JokeConstraint
Direct Known Subclasses:
InstantiationConstraintFLevel

public class InstantiationConstraintFamiliarityScore
extends Object
implements InstantiationConstraint

An InstantiationConstraint that constrains the minimum familiarity scores found in the keyword instantiations of a joke.

Author:
Ruli Manurung
See Also:
Lexeme.getFamiliarityScore()

Field Summary
(package private)  float answerThreshold
          The minimum threshold FScore frequency allowable by this constraint for answer lexemes.
(package private)  float questionThreshold
          The minimum threshold FScore allowable by this constraint for question lexemes.
 
Constructor Summary
InstantiationConstraintFamiliarityScore(float _q, float _a)
          Constructor is very simple -- just provide the two threshold values: the first for the question lexemes, and the second for the answer lexemes.
 
Method Summary
 String getSQLConstraint(Clause s, List<SQLSelectElement> taqlsses)
          Returns an SQL code snippet that is to be appended to the WHERE clause of the SQL query when instantiating the given Clause.
 void handleSchema(SQLQuerySchema schemaSQLQuery)
          Modifies the given SQLQuerySchema to reflect this constraint.
 String toString()
           
 boolean validate(JokeStructure j)
          Returns true if the given JokeStructure satisfies this constraint, and false if not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

questionThreshold

float questionThreshold
The minimum threshold FScore allowable by this constraint for question lexemes.


answerThreshold

float answerThreshold
The minimum threshold FScore frequency allowable by this constraint for answer lexemes.

Constructor Detail

InstantiationConstraintFamiliarityScore

public InstantiationConstraintFamiliarityScore(float _q,
                                               float _a)
Constructor is very simple -- just provide the two threshold values: the first for the question lexemes, and the second for the answer lexemes.

Parameters:
_q - Question lexeme FScore threshold
_a - Answer lexeme FScore threshold
Method Detail

handleSchema

public void handleSchema(SQLQuerySchema schemaSQLQuery)
Description copied from interface: InstantiationConstraint
Modifies the given SQLQuerySchema to reflect this constraint.

Specified by:
handleSchema in interface InstantiationConstraint

getSQLConstraint

public String getSQLConstraint(Clause s,
                               List<SQLSelectElement> taqlsses)
Description copied from interface: InstantiationConstraint
Returns an SQL code snippet that is to be appended to the WHERE clause of the SQL query when instantiating the given Clause.

Specified by:
getSQLConstraint in interface InstantiationConstraint
Parameters:
s - the Clause being instantiated.
Returns:
-- the String to be appended to the WHERE clause. As a contract, we require that it appear between parentheses, e.g. "(...)" for readability purposes.

validate

public boolean validate(JokeStructure j)
Description copied from interface: JokeConstraint
Returns true if the given JokeStructure satisfies this constraint, and false if not.

Specified by:
validate in interface JokeConstraint
Parameters:
j - the JokeStructure being validated
Returns:
-- true if j satisfies this constraint, false otherwise.

toString

public String toString()
Overrides:
toString in class Object