Package org.apache.uima.alchemy.digester.json

Examples of org.apache.uima.alchemy.digester.json.JsonDigester


import java.net.URISyntaxException;

public class JsonTextConceptDigester implements OutputDigester {
  public Results parseAlchemyXML(InputStream xmlReader) throws IOException, SAXException,
          URISyntaxException {
    Digester digester = new JsonDigester();
    digester.setValidating(false);

    digester.addObjectCreate("$", ConceptResults.class);
    digester.addBeanPropertySetter("$/status", "status");
    digester.addBeanPropertySetter("$/statusInfo", "statusInfo");
    digester.addBeanPropertySetter("$/url", "url");
    digester.addBeanPropertySetter("$/language", "language");
    digester.addObjectCreate("$/concepts/concept", Concept.class);
    digester.addBeanPropertySetter("$/concepts/concept/text", "text");
    digester.addBeanPropertySetter("$/concepts/concept/relevance", "relevance");
    digester.addBeanPropertySetter("$/concepts/concept/website", "website");
    digester.addBeanPropertySetter("$/concepts/concept/geo", "geo");
    digester.addBeanPropertySetter("$/concepts/concept/dbpedia", "dbpedia");
    digester.addBeanPropertySetter("$/concepts/concept/yago", "yago");
    digester.addBeanPropertySetter("$/concepts/concept/musicBrainz", "musicBrainz");
    digester.addBeanPropertySetter("$/concepts/concept/opencyc", "opencyc");
    digester.addBeanPropertySetter("$/concepts/concept/freebase", "freebase");
    digester.addBeanPropertySetter("$/concepts/concept/ciaFactbook", "ciaFactbook");
    digester.addBeanPropertySetter("$/concepts/concept/census", "census");
    digester.addBeanPropertySetter("$/concepts/concept/geonames", "geonames");
    digester.addBeanPropertySetter("$/concepts/concept/crunchbase", "crunchbase");
    digester.addBeanPropertySetter("$/concepts/concept/semanticCrunchbase", "semanticCrunchbase");
    digester.addSetNext("$/concepts", "addConcept");

    return (Results) digester.parse(xmlReader);
  }
View Full Code Here


public class JsonTextRankedEntityExtractionDigester implements OutputDigester {

  public Results parseAlchemyXML(InputStream stream) throws IOException, SAXException,
          URISyntaxException {

    Digester digester = new JsonDigester();
    digester.setValidating(false);
    digester.addObjectCreate("$", EntitiesResults.class);
    digester.addBeanPropertySetter("$/status");
    digester.addBeanPropertySetter("$/statusInfo", "statusInfo");
    digester.addBeanPropertySetter("$/url");
    digester.addBeanPropertySetter("$/language");
    digester.addObjectCreate("$/entities", Entity.class);
    digester.addBeanPropertySetter("$/entities/type");
    digester.addBeanPropertySetter("$/entities/relevance");
    digester.addBeanPropertySetter("$/entities/count");
    digester.addBeanPropertySetter("$/entities/text");
    digester.addObjectCreate("$/entities/disambiguated", Disambiguated.class);
    digester.addBeanPropertySetter("$/entities/disambiguated/name", "name");
    digester.addBeanPropertySetter("$/entities/disambiguated/subType", "subType");
    digester.addBeanPropertySetter("$/entities/disambiguated/website", "website");
    digester.addBeanPropertySetter("$/entities/disambiguated/geo", "geo");
    digester.addBeanPropertySetter("$/entities/disambiguated/dbpedia", "dbpedia");
    digester.addBeanPropertySetter("$/entities/disambiguated/yago", "yago");
    digester.addBeanPropertySetter("$/entities/disambiguated/opencyc", "opencyc");
    digester.addBeanPropertySetter("$/entities/disambiguated/umbel", "umbel");
    digester.addBeanPropertySetter("$/entities/disambiguated/freebase", "freebase");
    digester.addBeanPropertySetter("$/entities/disambiguated/ciaFactbook", "ciaFactbook");
    digester.addBeanPropertySetter("$/entities/disambiguated/census", "census");
    digester.addBeanPropertySetter("$/entities/disambiguated/geonames", "geonames");
    digester.addBeanPropertySetter("$/entities/disambiguated/musicBrainz", "musicBrainz");
    digester.addSetNext("$/entities/disambiguated", "setDisambiguated");
    digester.addObjectCreate("$/entities/quotations", Quotations.class);
    digester.addBeanPropertySetter("$/entities/quotations/quotation", "quotation");
    digester.addSetNext("$/entities/quotations", "setQuotations");
    digester.addSetNext("$/entities", "addEntity");
    return (Results) digester.parse(stream);
  }
View Full Code Here

public class JsonTextCategorizationDigester implements OutputDigester {

  public Results parseAlchemyXML(InputStream stream) throws IOException, SAXException,
          URISyntaxException {

    Digester digester = new JsonDigester();
    digester.setValidating(false);
    digester.addObjectCreate("$", CategorizationResults.class);
    digester.addBeanPropertySetter("$/status", "status");
    digester.addBeanPropertySetter("$/statusInfo", "statusInfo");
    digester.addBeanPropertySetter("$/url", "url");
    digester.addBeanPropertySetter("$/language", "language");
    digester.addBeanPropertySetter("$/category", "category");
    digester.addBeanPropertySetter("$/score", "score");
    return (Results) digester.parse(stream);
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.alchemy.digester.json.JsonDigester

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.