Search in sources :

Example 1 with CONLLReader

use of edu.illinois.cs.cogcomp.depparse.io.CONLLReader in project cogcomp-nlp by CogComp.

the class MainClass method getStructuredData.

private static SLProblem getStructuredData(String filepath, LabeledChuLiuEdmondsDecoder infSolver) throws Exception {
    CONLLReader depReader = new CONLLReader(new Preprocessor(), useGoldPOS, conllIndexOffset);
    depReader.startReading(filepath);
    SLProblem problem = new SLProblem();
    DepInst instance = depReader.getNext();
    while (instance != null) {
        infSolver.updateInferenceSolver(instance);
        Pair<IInstance, IStructure> pair = getSLPair(instance);
        problem.addExample(pair.getFirst(), pair.getSecond());
        instance = depReader.getNext();
    }
    logger.info("{} of dependency instances.", problem.size());
    return problem;
}
Also used : Preprocessor(edu.illinois.cs.cogcomp.depparse.io.Preprocessor) DepInst(edu.illinois.cs.cogcomp.depparse.core.DepInst) CONLLReader(edu.illinois.cs.cogcomp.depparse.io.CONLLReader)

Aggregations

DepInst (edu.illinois.cs.cogcomp.depparse.core.DepInst)1 CONLLReader (edu.illinois.cs.cogcomp.depparse.io.CONLLReader)1 Preprocessor (edu.illinois.cs.cogcomp.depparse.io.Preprocessor)1