Search in sources :

Example 11 with Tree

use of edu.cmu.lti.chineseNLP.util.Tree in project lucida by claritylab.

the class FocusFinder method findFocusTerm.

/**
     * Finds the focus word, given a Tree.
     * 
     * @param tree The syntactic parse tree object
     * @return the focus word as a Term or null, if one does not exist
     */
public static Term findFocusTerm(Tree tree) {
    try {
        Tree t = findFocusNode(tree);
        if (t != null) {
            Term res = new Term(0, 0, TreeHelper.getLeaves(t));
            res.setPOS(t.getLabel());
            return res;
        }
        return null;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Also used : Tree(edu.cmu.lti.chineseNLP.util.Tree) Term(edu.cmu.lti.javelin.qa.Term)

Aggregations

Tree (edu.cmu.lti.chineseNLP.util.Tree)11 Term (edu.cmu.lti.javelin.qa.Term)6 BufferedReader (java.io.BufferedReader)2 FileReader (java.io.FileReader)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 IndexWord (net.didion.jwnl.data.IndexWord)2 Feature (edu.cmu.minorthird.classify.Feature)1 MutableInstance (edu.cmu.minorthird.classify.MutableInstance)1 Properties (info.ephyra.util.Properties)1 BufferedWriter (java.io.BufferedWriter)1 FileInputStream (java.io.FileInputStream)1 FileWriter (java.io.FileWriter)1