当前位置: 首页>>代码示例>>Java>>正文


Java DataFactory类代码示例

本文整理汇总了Java中org.lappsgrid.core.DataFactory的典型用法代码示例。如果您正苦于以下问题:Java DataFactory类的具体用法?Java DataFactory怎么用?Java DataFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataFactory类属于org.lappsgrid.core包,在下文中一共展示了DataFactory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMetadata

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String getMetadata()
{
	try
	{
		return service.getMetadata();
	}
	catch(Exception e)
	{
		//e.printStackTrace();
		return DataFactory.error(e.getMessage());
	}
}
 
开发者ID:lapps,项目名称:org.lappsgrid.client,代码行数:13,代码来源:AbstractClient.java

示例2: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Tagger.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected...");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:pos", step + " " + producer + " " + Contents.TagSets.GATE);
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:28,代码来源:Tagger.java

示例3: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
@Override
   public String execute(String json)
   {
      Document document = null;
      try
      {
         document = doExecute(json);
      }
      catch (Exception e)
      {
         return DataFactory.error("Unable to execute the Coreferencer.", e);
      }
      if (document == null)
      {
         return DataFactory.error(UNEXPECTED);
      }
      String producer = this.getClass().getName() + "_" + Version.getVersion();
      FeatureMap features = document.getFeatures();
      Integer step = (Integer) features.get("lapps:step");
      if (step == null) {
         step = 1;
      }
      features.put("lapps:step", step + 1);
      features.put("lapps:PRONOMINAL_CORREFERNCE", step + " " + producer + " coref:gate");
//      features.put(Metadata.Contains.TYPE, "coref:gate");
//      features.put(Metadata.Contains.PRODUCER, producer);
//      features.put("annotation", Annotations.COREFERENCE);
      String result = DataFactory.gateDocument(document.toXml());
      Factory.deleteResource(document);
      return result;
   }
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:32,代码来源:Coreferencer.java

示例4: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Tokenizer.", e);
   }
   if (document == null)
   {
      return DataFactory.error(BUSY);
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();

   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:" + Annotations.TOKEN, step + " " + producer + " " + Contents.Tokenizations.ANNIE);

   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:30,代码来源:Tokenizer.java

示例5: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Sentence Splitter.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected...");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:" + Annotations.SENTENCE, step + " " + producer + " " + Contents.Chunks.SENTENCES);
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:28,代码来源:SentenceSplitter.java

示例6: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Gazetteer.", e);
   }
   if (document == null)
   {
      return DataFactory.error(BUSY);
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:lookup", step + " " + producer + " lookup:gate");
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:28,代码来源:Gazetteer.java

示例7: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the OrthoMatcher.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected...");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:coref", step + " " + producer + " coref:annie");
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:28,代码来源:OrthoMatcher.java

示例8: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the NounPhraseChunker.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected.");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:nchunk", step + " " + producer + " chunk:annie");
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:28,代码来源:NounPhraseChunker.java

示例9: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Verb Phrase Chunker.", e);
   }
   if (document == null)
   {
      return DataFactory.error(BUSY);
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:vchunk", step + producer + " " + Contents.Chunks.VERBS);
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:28,代码来源:VerbPhraseChunker.java

示例10: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
@Override
   public String execute(String input)
   {
		String result;
      Data<String> data = Serializer.parse(input, Data.class);
      if (!Uri.GATE.equals(data.getDiscriminator()))
      {
         return DataFactory.error("Invalid discriminator type: " + data.getDiscriminator());
      }
      String payload = data.getPayload();
      if (payload == null)
      {
         return DataFactory.error("Payload is empty");
      }
      Document document = null;
      try
      {
         logger.info("Converting document to JSON");
         document = Factory.newDocument(payload);
         logger.debug("Gate document created.");
         result = GateSerializer.toJson(document);
         logger.debug("Document serialized to JSON.");
//         result = new Data(Uri.JSON, json);
      }
//		catch (NullPointerException e)
      catch (NullPointerException | ResourceInstantiationException e)
      {
         logger.error("Unable to convert document.", e);
         result = DataFactory.error(e.getMessage());
      }
      finally
      {
         Factory.deleteResource(document);
      }
      return result;
   }
 
开发者ID:oanc,项目名称:org.anc.lapps.gate.converter-service,代码行数:37,代码来源:GateToJsonConverter.java

示例11: execute

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
public String execute(String input)
{
	Document document = null;
	try
	{
		document = super.doExecute(input);
	}
	catch (Exception e)
	{
		return DataFactory.error("Unable to execute the Named Entity Recognizer.", e);
	}

	if (document == null)
	{
		return DataFactory.error("This was unexpected... the GATE NER component returned a NULL document.");
	}

	String producer = this.getClass().getName() + "_" + Version.getVersion();
	FeatureMap features = document.getFeatures();
	Integer step = (Integer) features.get("lapps:step");
	if (step == null)
	{
		step = 1;
	}
	AnnotationSet set = document.getAnnotations();
	Iterator<Annotation> iterator = set.iterator();
	boolean hasLocation = false;
	boolean hasPerson = false;
	boolean hasOrganization = false;
	// Counter so we know to stop searching once we've found all three
	// annotation types
	int found = 0;
	while (iterator.hasNext() && found < 3)
	{
		Annotation annotation = iterator.next();
		String type = annotation.getType();
		if ("Location".equals(type) && !hasLocation)
		{
			++found;
			hasLocation = true;
		} else if ("Organization".equals(type) && !hasOrganization)
		{
			++found;
			hasOrganization = true;
		} else if ("Person".equals(type) && !hasPerson)
		{
			++found;
			hasPerson = true;
		}
	}
	features.put("lapps:step", step + 1);

	// TODO The Annotations class has changed and the feature values added should be rolled
	// back to what they were originally.
	if (hasLocation)
	{
		features.put("lapps:" + Annotations.LOCATION, step + " " + producer + " ner:annie");
	}
	if (hasPerson)
	{
		features.put("lapps:" + Annotations.PERSON, step + " " + producer + " ner:annie");
	}
	if (hasOrganization)
	{
		features.put("lapps:" + Annotations.ORGANIZATION, step + " " + producer + " ner:annie");
	}
	String result = DataFactory.gateDocument(document.toXml());
	Factory.deleteResource(document);
	return result;
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate,代码行数:71,代码来源:NamedEntityRecognizer.java

示例12: setup

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
@Before
public void setup() throws IOException
{
	xml = ResourceLoader.loadString("GateTokens.xml");
	json = DataFactory.gateDocument(xml);
}
 
开发者ID:oanc,项目名称:org.anc.lapps.gate.converter-service,代码行数:7,代码来源:SerializerTests.java

示例13: list

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
/**
* Sends LIST request (<a href="http://vocab.lappsgrid.org/ns/action/list">http://vocab.lappsgrid.org/ns/action/list</a>)
* with {@code start} and {@code end} offsets to the data source and parse the result into a {@link java.util.List}
* of strings.
*
* @return A list of document ID values.
*/
 public List<String> list(int start, int end)
 {
String json = service.execute(DataFactory.list(start, end));
Data<List<String>> data = Serializer.parse(json, Data.class);
return data.getPayload();
 }
 
开发者ID:lapps,项目名称:org.lappsgrid.client,代码行数:14,代码来源:DataSourceClient.java

示例14: get

import org.lappsgrid.core.DataFactory; //导入依赖的package包/类
/**
* Retrieves a single document from the datasource.
*
* @param key a document ID.
* @return the document from the data source.  Typically this will be a LIF container
* inside a Data object.
*/
 public String get(String key)
 {
    return service.execute(DataFactory.get(key));
 }
 
开发者ID:lapps,项目名称:org.lappsgrid.client,代码行数:12,代码来源:DataSourceClient.java


注:本文中的org.lappsgrid.core.DataFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。