use of info.ephyra.answerselection.AnswerPattern in project lucida by claritylab.
the class AnswerPatternFilter method dropLowSupport.
/**
* Drops answer patterns that have a support of <code>supportThresh</code>
* or less.
*
* @param supportThresh the support threshold
*/
public static void dropLowSupport(float supportThresh) {
// for each PROPERTY
for (String prop : props.keySet()) {
HashSet<AnswerPattern> patterns = props.get(prop);
int n = nOfPassages.get(prop);
HashSet<AnswerPattern> remaining = new HashSet<AnswerPattern>();
// check the threshold for each answer pattern
for (AnswerPattern pattern : patterns) if ((pattern.getCorrect() / (float) n) >= supportThresh)
remaining.add(pattern);
props.put(prop, remaining);
}
}
use of info.ephyra.answerselection.AnswerPattern in project lucida by claritylab.
the class AnswerPatternFilter method addPattern.
/**
* Adds an answer pattern for a specific PROPERTY.
*
* @param expr pattern descriptor
* @param prop PROPERTY that the pattern extracts
* @return true, iff a new pattern was added
*/
public static boolean addPattern(String expr, String prop) {
// get the answer patterns for the specified PROPERTY
HashSet<AnswerPattern> patterns = props.get(prop);
if (patterns == null) {
// new PROPERTY
patterns = new HashSet<AnswerPattern>();
props.put(prop, patterns);
nOfPassages.put(prop, 0);
}
// if the pattern is not in the set, add it
boolean added = patterns.add(new AnswerPattern(expr, prop));
// print out new patterns
if (added)
MsgPrinter.printStatusMsg(prop + ": " + expr);
return added;
}
Aggregations