Package org.apache.stanbol.enhancer.servicesapi.impl

Examples of org.apache.stanbol.enhancer.servicesapi.impl.StringSource


        engine = new PaodingTokenizerEngine();
        engine.analysedTextFactory = AnalysedTextFactory.getDefaultInstance();
        Dictionary<String,Object> config = new Hashtable<String,Object>();
        config.put(EnhancementEngine.PROPERTY_NAME, "paoding-token");
        engine.activate(new MockComponentContext(config));
        contentItem = contentItemFactory.createContentItem(id, new StringSource(text));
        //add an annotation that this is Japanese
        contentItem.getMetadata().add(new TripleImpl(id, Properties.DC_LANGUAGE,
            new PlainLiteralImpl("zh")));
    }
View Full Code Here


    @AfterClass
    public static void shutdownServices() {
    }

    public static ContentItem getContentItem(final String id, final String text) throws IOException {
        return ciFactory.createContentItem(new UriRef(id),new StringSource(text));
    }
View Full Code Here

        EntityLinkerConfig linkerConfig = new EntityLinkerConfig();
        linkerConfig.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
        KeywordLinkingEngine engine = KeywordLinkingEngine.createInstance(openNLP, searcher, new TextAnalyzerConfig(),
            linkerConfig);
        engine.referencedSiteName = TEST_REFERENCED_SITE_NAME;
        ContentItem ci = ciFactory.createContentItem(new StringSource(TEST_TEXT));
        //tells the engine that this is an English text
        ci.getMetadata().add(new TripleImpl(ci.getUri(), DC_LANGUAGE, new PlainLiteralImpl("en")));
        //compute the enhancements
        engine.computeEnhancements(ci);
        //validate the enhancement results
View Full Code Here

  public static void shutdownServices() {
    nerEngine.deactivate(null);
  }

    public static ContentItem wrapAsContentItem(final String text) throws IOException {
        return ciFactory.createContentItem(new StringSource(text));
    }
View Full Code Here

    public static void shutdownServices() {
        System.getProperties().setProperty("user.dir", userDir);
    }

    public static ContentItem getContentItem(final String id, final String text) throws IOException {
        return ciFactory.createContentItem(new UriRef(id),new StringSource(text));
    }
View Full Code Here

            calaisExtractor.setLicenseKey(TEST_LICENSE_KEY);
        }
    }

    public static ContentItem wrapAsContentItem(final String text) throws IOException {
        return ciFactory.createContentItem(new StringSource(text));
    }
View Full Code Here

  public static void shutdownServices() {
    sentimentAnalysisEngine.deactivate(null);
  }

  public static ContentItem wrapAsContentItem(final String text) throws IOException {
    return ciFactory.createContentItem(new StringSource(text));
  }
View Full Code Here

        engine = null;
    }
   
    @Test
    public void testEngine() throws IOException, EngineException {
        ContentItem ci = ciFactory.createContentItem(new StringSource(text));
        Assert.assertNotNull(ci);
        AnalysedText at = atFactory.createAnalysedText(ci, ci.getBlob());
        Assert.assertNotNull(at);
        ci.getMetadata().add(new TripleImpl(ci.getUri(), DC_LANGUAGE, new PlainLiteralImpl("it")));
        Assert.assertEquals("it", EnhancementEngineHelper.getLanguage(ci));
View Full Code Here

  private static void shutdownEngine(CeliLemmatizerEnhancementEngine morphoAnalysisEngine) {
    morphoAnalysisEngine.deactivate(null);
  }

    private static ContentItem wrapAsContentItem(final String text) throws IOException {
        return ciFactory.createContentItem(new StringSource(text));
    }
View Full Code Here

    @Test
    public void testText() throws EngineException, IOException {
        log.info(">>> testText <<<");
        String text = "The Stanbol enhancer can detect famous cities such as " +
            "Paris and people such as Bob Marley.";
        ContentItem ci = ciFactory.createContentItem(new StringSource(text));
        Assert.assertEquals(1, ContentItemHelper.getContentParts(ci, Blob.class).size());
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.servicesapi.impl.StringSource

Copyright © 2018 www.massapicom. 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.