當前位置: 首頁>>代碼示例>>Java>>正文


Java DataFactory.gateDocument方法代碼示例

本文整理匯總了Java中org.lappsgrid.core.DataFactory.gateDocument方法的典型用法代碼示例。如果您正苦於以下問題:Java DataFactory.gateDocument方法的具體用法?Java DataFactory.gateDocument怎麽用?Java DataFactory.gateDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lappsgrid.core.DataFactory的用法示例。


在下文中一共展示了DataFactory.gateDocument方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例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 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

示例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 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

示例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 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

示例9: 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

示例10: 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


注:本文中的org.lappsgrid.core.DataFactory.gateDocument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。