Search in sources :

Example 1 with PointerTargetNodeList

use of net.didion.jwnl.data.list.PointerTargetNodeList in project lucida by claritylab.

the class WordNetAnswerTypeMapping method findWnMapMatch.

private static AnswerType findWnMapMatch(Synset synset, int level) throws Exception {
    AnswerType type = null;
    String synsetId = buildSynsetString(synset);
    String typeStr = wnAtypeMap.get(synsetId);
    if (typeStr != null) {
        type = AnswerType.constructFromString(typeStr);
        type.setConfidence(1.0 - ((double) level / 100.0));
        return type;
    }
    PointerTargetNodeList ptNodeList = null;
    ptNodeList = pUtils.getDirectHypernyms(synset);
    for (int i = 0; i < ptNodeList.size(); i++) {
        Synset parent = (Synset) ((PointerTargetNode) ptNodeList.get(i)).getPointerTarget();
        type = findWnMapMatch(parent, level + 1);
        if (type != null)
            return type;
    }
    return type;
}
Also used : Synset(net.didion.jwnl.data.Synset) PointerTargetNodeList(net.didion.jwnl.data.list.PointerTargetNodeList)

Aggregations

Synset (net.didion.jwnl.data.Synset)1 PointerTargetNodeList (net.didion.jwnl.data.list.PointerTargetNodeList)1