Search in sources :

Example 21 with ResourceManager

use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.

the class NerOntonotesTest method testOntonotesNer.

@Test
public void testOntonotesNer() {
    TextAnnotationBuilder tab = new TokenizerTextAnnotationBuilder(new StatefulTokenizer());
    Properties props = new Properties();
    NERAnnotator nerOntonotes = NerAnnotatorManager.buildNerAnnotator(new ResourceManager(props), ViewNames.NER_ONTONOTES);
    TextAnnotation taOnto = tab.createTextAnnotation("", "", TEST_INPUT);
    try {
        nerOntonotes.getView(taOnto);
    } catch (AnnotatorException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    View v = taOnto.getView(nerOntonotes.getViewName());
    assertEquals(v.getConstituents().size(), 4);
}
Also used : TextAnnotationBuilder(edu.illinois.cs.cogcomp.annotation.TextAnnotationBuilder) TokenizerTextAnnotationBuilder(edu.illinois.cs.cogcomp.nlp.utility.TokenizerTextAnnotationBuilder) TokenizerTextAnnotationBuilder(edu.illinois.cs.cogcomp.nlp.utility.TokenizerTextAnnotationBuilder) StatefulTokenizer(edu.illinois.cs.cogcomp.nlp.tokenizer.StatefulTokenizer) AnnotatorException(edu.illinois.cs.cogcomp.annotation.AnnotatorException) ResourceManager(edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager) Properties(java.util.Properties) TextAnnotation(edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation) View(edu.illinois.cs.cogcomp.core.datastructures.textannotation.View) Test(org.junit.Test)

Example 22 with ResourceManager

use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.

the class Main method processArgument.

/**
     * The only argument is {@code <config_file_name>}. This method will capture the config file
     * name, and initialize the system when it does.
     * 
     * @throws IOException
     * @see edu.illinois.cs.cogcomp.ner.AbstractMain#processArgument(java.lang.String[], int)
     */
@Override
protected int processArgument(String[] args, int current) throws Exception {
    if (args[current].equals("-c"))
        bracketedOutput = false;
    else {
        if (new File(args[current]).exists()) {
            System.out.println("Loading properties from " + args[current]);
            this.resourceManager = new ResourceManager(args[current]);
            System.out.println("Completed loading properties.");
        } else
            throw new RuntimeException("The configuration file \"" + args[current] + "\" did not exist.");
    }
    return current++;
}
Also used : ResourceManager(edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager) File(java.io.File) InFile(edu.illinois.cs.cogcomp.ner.IO.InFile)

Example 23 with ResourceManager

use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.

the class TestPOS method main.

/**
     * Implements the program described above.
     *
     * @param args The command line parameters.
     **/
public static void main(String[] args) {
    // Parse the command line
    // if (args.length != 1) {
    // logger.error("usage: java edu.illinois.cs.cogcomp.lbj.pos.TestPOS <text file>");
    // System.exit(1);
    // }
    // String testingFile = args[0];
    ResourceManager rm = new POSConfigurator().getDefaultConfig();
    String testingFile = rm.getString("testData");
    TestDiscrete.testDiscrete(new TestDiscrete(), new POSTagger(), new POSLabel(), new POSBracketToToken(testingFile), true, 0);
}
Also used : TestDiscrete(edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete) ResourceManager(edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager) POSBracketToToken(edu.illinois.cs.cogcomp.lbjava.nlp.seg.POSBracketToToken)

Example 24 with ResourceManager

use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.

the class TestPOSModels method main.

public static void main(String[] args) {
    ResourceManager rm = new POSConfigurator().getDefaultConfig();
    TestPOSModels test = new TestPOSModels(rm.getString("testData"));
    test.testAccuracy();
}
Also used : ResourceManager(edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager)

Example 25 with ResourceManager

use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.

the class ChunkerBenchmark method main.

public static void main(String[] args) {
    ResourceManager rm = new ChunkerConfigurator().getDefaultConfig();
    String testFileName = rm.getString("testGoldPOSData");
    String testNoPOSFileName = rm.getString("testNoPOSData");
    System.out.println("\nWith Gold POS");
    ChunkTester.chunkTester(testFileName);
    System.out.println("\nWith NO POS");
    ChunkTester.chunkTester(testNoPOSFileName);
}
Also used : ResourceManager(edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager)

Aggregations

ResourceManager (edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager)28 Properties (java.util.Properties)14 Test (org.junit.Test)8 TextAnnotation (edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation)6 StatefulTokenizer (edu.illinois.cs.cogcomp.nlp.tokenizer.StatefulTokenizer)5 TokenizerTextAnnotationBuilder (edu.illinois.cs.cogcomp.nlp.utility.TokenizerTextAnnotationBuilder)5 AnnotatorException (edu.illinois.cs.cogcomp.annotation.AnnotatorException)4 ChunkerAnnotator (edu.illinois.cs.cogcomp.chunker.main.ChunkerAnnotator)3 DepAnnotator (edu.illinois.cs.cogcomp.depparse.DepAnnotator)3 NERAnnotator (edu.illinois.cs.cogcomp.ner.NERAnnotator)3 PipelineConfigurator (edu.illinois.cs.cogcomp.pipeline.common.PipelineConfigurator)3 Stanford331Configurator (edu.illinois.cs.cogcomp.pipeline.common.Stanford331Configurator)3 POSAnnotator (edu.illinois.cs.cogcomp.pos.POSAnnotator)3 PrepSRLAnnotator (edu.illinois.cs.cogcomp.prepsrl.PrepSRLAnnotator)3 POSTaggerAnnotator (edu.stanford.nlp.pipeline.POSTaggerAnnotator)3 ParserAnnotator (edu.stanford.nlp.pipeline.ParserAnnotator)3 IOException (java.io.IOException)3 TextAnnotationBuilder (edu.illinois.cs.cogcomp.annotation.TextAnnotationBuilder)2 SpanLabelView (edu.illinois.cs.cogcomp.core.datastructures.textannotation.SpanLabelView)2 InFile (edu.illinois.cs.cogcomp.ner.IO.InFile)2