Search in sources :

Example 6 with Feature

use of edu.cmu.minorthird.classify.Feature in project lucida by claritylab.

the class ScoreNormalizationFilter method addMaxScoreFeature.

/**
	 * Adds the maximum score of all factoid answers from the same extractor as
	 * a feature to the instance.
	 */
private static void addMaxScoreFeature(MutableInstance instance, Result result, Result[] results) {
    // calculate maximum score
    double maxScore = 0;
    //		String extractor = result.getExtractionTechniques()[0];
    for (Result r : results) if (r.getScore() > 0 && r.getScore() < Float.POSITIVE_INFINITY)
        //				if (r.extractedWith(extractor))
        maxScore = Math.max(r.getScore(), maxScore);
    Feature feature = new Feature(MAX_SCORE_F);
    instance.addNumeric(feature, maxScore);
}
Also used : Feature(edu.cmu.minorthird.classify.Feature) Result(info.ephyra.search.Result)

Example 7 with Feature

use of edu.cmu.minorthird.classify.Feature in project lucida by claritylab.

the class ScoreNormalizationFilter method addScoreFeature.

/**
	 * Adds the score of the answer candidate as a feature to the instance.
	 */
private static void addScoreFeature(MutableInstance instance, Result result) {
    float score = result.getScore();
    Feature feature = new Feature(SCORE_F);
    instance.addNumeric(feature, score);
}
Also used : Feature(edu.cmu.minorthird.classify.Feature)

Example 8 with Feature

use of edu.cmu.minorthird.classify.Feature in project lucida by claritylab.

the class ScoreNormalizationFilter method addMeanScoreFeature.

/**
	 * Adds the mean score of all factoid answers from the same extractor as a
	 * feature to the instance.
	 */
private static void addMeanScoreFeature(MutableInstance instance, Result result, Result[] results) {
    // calculate mean score
    double meanScore = 0;
    int numFactoid = 0;
    //		String extractor = result.getExtractionTechniques()[0];
    for (Result r : results) if (r.getScore() > 0 && r.getScore() < Float.POSITIVE_INFINITY) {
        //				if (r.extractedWith(extractor)) {
        meanScore += r.getScore();
        numFactoid++;
    //				}
    }
    meanScore /= numFactoid;
    Feature feature = new Feature(MEAN_SCORE_F);
    instance.addNumeric(feature, meanScore);
}
Also used : Feature(edu.cmu.minorthird.classify.Feature) Result(info.ephyra.search.Result)

Example 9 with Feature

use of edu.cmu.minorthird.classify.Feature in project lucida by claritylab.

the class ScoreNormalizationFilter method addNumAnswersFeature.

/**
	 * Adds the number of factoid answers from the same extractor as a feature
	 * to the instance.
	 */
private static void addNumAnswersFeature(MutableInstance instance, Result result, Result[] results) {
    // get number of factoid answers
    int numFactoid = 0;
    //		String extractor = result.getExtractionTechniques()[0];
    for (Result r : results) if (r.getScore() > 0 && r.getScore() < Float.POSITIVE_INFINITY)
        //				if (r.extractedWith(extractor))
        numFactoid++;
    Feature feature = new Feature(NUM_ANSWERS_F);
    instance.addNumeric(feature, numFactoid);
}
Also used : Feature(edu.cmu.minorthird.classify.Feature) Result(info.ephyra.search.Result)

Example 10 with Feature

use of edu.cmu.minorthird.classify.Feature in project lucida by claritylab.

the class ScoreNormalizationFilter method addExtractorFeature.

/**
	 * Adds the extractor used to obtain the answer candidate as a feature to
	 * the instance.
	 */
private static void addExtractorFeature(MutableInstance instance, Result result) {
    String extractor = result.getExtractionTechniques()[0];
    Feature feature = new Feature(extractor);
    instance.addBinary(feature);
}
Also used : Feature(edu.cmu.minorthird.classify.Feature)

Aggregations

Feature (edu.cmu.minorthird.classify.Feature)15 Result (info.ephyra.search.Result)4 Iterator (java.util.Iterator)3 Term (edu.cmu.lti.javelin.qa.Term)2 Example (edu.cmu.minorthird.classify.Example)2 MutableInstance (edu.cmu.minorthird.classify.MutableInstance)2 Matcher (java.util.regex.Matcher)2 Tree (edu.cmu.lti.chineseNLP.util.Tree)1 BasicDataset (edu.cmu.minorthird.classify.BasicDataset)1 Dataset (edu.cmu.minorthird.classify.Dataset)1 Instance (edu.cmu.minorthird.classify.Instance)1 CrossValidatedDataset (edu.cmu.minorthird.classify.experiments.CrossValidatedDataset)1 StringReader (java.io.StringReader)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 IndexWord (net.didion.jwnl.data.IndexWord)1 Document (org.w3c.dom.Document)1 InputSource (org.xml.sax.InputSource)1