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

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


        log.info(" ... created {} Entity references ", numLinks);

    }

    public static ContentItem getContentItem(final String id) throws IOException {
        ContentItem ci = ciFactory.createContentItem(new UriRef(id), new StringSource("Not used"));
        ci.getMetadata().addAll(testMetadata);
        return ci;
    }
View Full Code Here


                                    @FormParam("format") String format,
                                    @FormParam("ajax") boolean buildAjaxview,
                                    @Context HttpHeaders headers) throws EnhancementException,
                                                                         IOException {
        log.info("enhance from From: " + content);
        ContentItem ci = ciFactory.createContentItem(new StringSource(content));
        if(!buildAjaxview){ //rewrite to a normal EnhancementRequest
            return enhanceFromData(ci, false, null, false, null, false, null, headers);
        } else { //enhance and build the AJAX response
            EnhancementException enhancementException;
            try {
View Full Code Here

    private static Entry<UriRef,Blob> textBlob;
   
    @BeforeClass
    public static final void setup() throws IOException {
        ci = ciFactory.createContentItem(new StringSource(text));
        textBlob = ContentItemHelper.getBlob(ci, Collections.singleton("text/plain"));
        analysedTextWithData = createAnalysedText();
        int sentence = text.indexOf('.')+1;
        Sentence sent1 = analysedTextWithData.addSentence(0, sentence);
        expectedSentences.put(sent1, "The Stanbol enhancer can detect famous " +
View Full Code Here

        engine = null;
    }
   
    @Test
    public void testEngineDe() throws IOException, EngineException {
        ContentItem ci = ciFactory.createContentItem(new StringSource(de_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("de")));
        Assert.assertEquals("de", EnhancementEngineHelper.getLanguage(ci));
View Full Code Here

  public static void shutdownServices() {
    langIdentifier.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() {
    classificationEngine.deactivate(null);
  }

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

    }

    public static ContentItem wrapAsContentItem(final String text) throws IOException {
      String id = "urn:org.apache.stanbol.enhancer:test:engines.zemanta:content-item-"
            + EnhancementEngineHelper.randomUUID().toString();
      return ciFactory.createContentItem(new UriRef(id), new StringSource(text));
    }
View Full Code Here

    public void testEngine() throws EngineException, IOException, ConfigurationException {
        LangIdEnhancementEngine langIdEngine = new LangIdEnhancementEngine();
        ComponentContext context =  new MockComponentContext();
        context.getProperties().put(EnhancementEngine.PROPERTY_NAME, "langid");
        langIdEngine.activate(context);
        ContentItem ci = ciFactory.createContentItem(new StringSource(text));
        langIdEngine.computeEnhancements(ci);
        HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>();
        expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri());
        expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral(
            langIdEngine.getClass().getName()));
View Full Code Here

        in.close();
        LanguageDetectionEnhancementEngine langIdEngine = new LanguageDetectionEnhancementEngine();
        ComponentContext context =  new MockComponentContext();
        context.getProperties().put(EnhancementEngine.PROPERTY_NAME, "langdetect");
        langIdEngine.activate(context);
        ContentItem ci = ciFactory.createContentItem(new StringSource(text));
        langIdEngine.computeEnhancements(ci);
        HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>();
        expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri());
        expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral(
            langIdEngine.getClass().getName()));
View Full Code Here

            new NEREngineConfig()){};
    }

    public static ContentItem wrapAsContentItem(final String id,
            final String text, String language) throws IOException {
      ContentItem ci =  ciFactory.createContentItem(new UriRef(id),new StringSource(text));
      if(language != null){
          ci.getMetadata().add(new TripleImpl(ci.getUri(), DC_LANGUAGE, new PlainLiteralImpl(language)));
      }
      return ci;
    }
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.