Examples of newJCas()


Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

            MultiBindAE.RES_KEY, extDesc);

    // Check the external resource was injected
    AnalysisEngineDescription aaed = createEngineDescription(aed1, aed2);
    AnalysisEngine ae = createEngine(aaed);
    ae.process(ae.newJCas());

    MultiBindAE.reset();

    // Check the external resource was injected
    SimplePipeline.runPipeline(CasCreationUtils.createCas(aaed.getAnalysisEngineMetaData()), aaed);
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

  @Test
  public void testIndexesWork() throws Exception {
    // Index should be added the descriptor and thus end up in the CAS generated from the
    // analysis engine.
    AnalysisEngine desc = createEngine(IndexTestComponent.class);
    JCas jcas = desc.newJCas();

    Token token1 = new Token(jcas, 1, 2);
    token1.addToIndexes();

    // index1 is a sorted index, so when adding a token twice, both remain in the index
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

    AggregateBuilder builder = new AggregateBuilder();
    builder.add(this.findDescription(ModifierExtractorAnnotator.class));
    builder.add(this.findDescription(DegreeOfRelationExtractorAnnotator.class));
    builder.add(this.findDescription(EntityMentionPairRelationExtractorAnnotator.class));
    AnalysisEngine engine = builder.createAggregate();
    JCas jCas = engine.newJCas();

    // populate the CAS with an example sentence
    // TODO: add annotations to support phrase chunk and dependency features
    TokenBuilder<BaseToken, Sentence> tokenBuilder = new TokenBuilder<BaseToken, Sentence>(
        BaseToken.class,
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

    TypePriorityList typePriorityList = typePriorities.getPriorityLists()[0];
    assertEquals(2, typePriorityList.getTypes().length);
    assertEquals("org.apache.uima.fit.type.Token", typePriorityList.getTypes()[0]);
    assertEquals("org.apache.uima.fit.type.Sentence", typePriorityList.getTypes()[1]);

    jCas = engine.newJCas();
    tokenBuilder.buildTokens(jCas, "word");
    FSIterator<Annotation> tokensInSentence = jCas.getAnnotationIndex().subiterator(
            JCasUtil.selectByIndex(jCas, Sentence.class, 0));
    assertFalse(tokensInSentence.hasNext());
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

    prioritizedTypeNames = new String[] { "org.apache.uima.fit.type.Sentence",
        "org.apache.uima.fit.type.Token" };
    engine = AnalysisEngineFactory.createEngine(
            org.apache.uima.fit.component.NoOpAnnotator.class, typeSystemDescription,
            prioritizedTypeNames, (Object[]) null);
    jCas = engine.newJCas();
    tokenBuilder.buildTokens(jCas, "word");
    tokensInSentence = jCas.getAnnotationIndex().subiterator(
            JCasUtil.selectByIndex(jCas, Sentence.class, 0));
    assertTrue(tokensInSentence.hasNext());
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

    // Instantiate component
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(desc, resMgr, null);

    // Test that injection works
    ae.process(ae.newJCas());
  }

  public static class MyAnalysisEngine extends JCasAnnotator_ImplBase {
    @ExternalResource(key = "injectedBean")
    private Object injectedBean;
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

    // Instantiate component
    AnalysisEngine ae = createEngine(MyAnalysisEngine.class);

    // Test that injection works
    ae.process(ae.newJCas());
  }

  public static class MyAnalysisEngine extends JCasAnnotator_ImplBase {
    @Autowired
    @Qualifier("otherBean")
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

  public void test() throws Exception {
    File outputFile = new File(folder.getRoot(), "dump-output.txt");

    AnalysisEngine writer = AnalysisEngineFactory.createEngine(CasDumpWriter.class,
            CasDumpWriter.PARAM_OUTPUT_FILE, outputFile.getPath());
    JCas jcas = writer.newJCas();
    CasIOUtil.readJCas(jcas, new File("src/test/resources/data/docs/test.xmi"));
    writer.process(jcas);
    assertTrue(outputFile.exists());

    String reference = readFileToString(
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

  @Test
  public void testIndexesWork() throws Exception {
    // Index should be added the descriptor and thus end up in the CAS generated from the
    // analysis engine.
    AnalysisEngine desc = createEngine(IndexTestComponent.class);
    JCas jcas = desc.newJCas();

    Token token1 = new Token(jcas, 1, 2);
    token1.addToIndexes();

    // index1 is a sorted index, so when adding a token twice, both remain in the index
View Full Code Here

Examples of org.apache.uima.analysis_engine.AnalysisEngine.newJCas()

    assertFalse(resMgr.isAutoWireEnabled());

    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(desc, resMgr, null);
    assertNotNull(ae);

    ae.process(ae.newJCas());
  }

  @Test
  public void testDirectInjectionAutowire() throws Exception {
    // Create analysis engine description
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.