Search in sources :

Example 1 with PrepSRLDataReader

use of edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader in project cogcomp-nlp by CogComp.

the class Main method train.

public void train() {
    if (!IOUtils.exists(modelsDir))
        IOUtils.mkdir(modelsDir);
    Learner classifier = new PrepSRLClassifier(modelName + ".lc", modelName + ".lex");
    Parser trainDataReader = new PrepSRLDataReader(dataDir, "train");
    BatchTrainer trainer = new BatchTrainer(classifier, trainDataReader, 1000);
    trainer.train(20);
    classifier.save();
    trainDataReader.close();
}
Also used : BatchTrainer(edu.illinois.cs.cogcomp.lbjava.learn.BatchTrainer) ConstrainedPrepSRLClassifier(edu.illinois.cs.cogcomp.prepsrl.inference.ConstrainedPrepSRLClassifier) PrepSRLDataReader(edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader) Learner(edu.illinois.cs.cogcomp.lbjava.learn.Learner) Parser(edu.illinois.cs.cogcomp.lbjava.parse.Parser)

Example 2 with PrepSRLDataReader

use of edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader in project cogcomp-nlp by CogComp.

the class Main method test.

public void test() {
    ConstrainedPrepSRLClassifier classifier = new ConstrainedPrepSRLClassifier();
    Parser testDataReader = new PrepSRLDataReader(dataDir, "test");
    TestDiscrete tester = new TestDiscrete();
    TestDiscrete.testDiscrete(tester, classifier, new PrepSRLClassifier.Label(), testDataReader, true, 100);
    testDataReader.close();
}
Also used : TestDiscrete(edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete) PrepSRLDataReader(edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader) ConstrainedPrepSRLClassifier(edu.illinois.cs.cogcomp.prepsrl.inference.ConstrainedPrepSRLClassifier) ConstrainedPrepSRLClassifier(edu.illinois.cs.cogcomp.prepsrl.inference.ConstrainedPrepSRLClassifier) Parser(edu.illinois.cs.cogcomp.lbjava.parse.Parser)

Aggregations

Parser (edu.illinois.cs.cogcomp.lbjava.parse.Parser)2 PrepSRLDataReader (edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader)2 ConstrainedPrepSRLClassifier (edu.illinois.cs.cogcomp.prepsrl.inference.ConstrainedPrepSRLClassifier)2 TestDiscrete (edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete)1 BatchTrainer (edu.illinois.cs.cogcomp.lbjava.learn.BatchTrainer)1 Learner (edu.illinois.cs.cogcomp.lbjava.learn.Learner)1