net.sf.okapi.common.Event.setResource()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中net.sf.okapi.common.Event.setResource()方法的一些代码示例,展示了Event.setResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setResource()方法的具体详情如下:
包路径:net.sf.okapi.common.Event
类名称:Event
方法名:setResource

Event.setResource介绍

[英]Sets the resource associated to this event.
[中]设置与此事件关联的资源。

代码示例

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rtfconversion

event.setResource(newDoc);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-wordcount

private IResource createResource(Event event) {
  if (event == null) return null;
  
  IResource res = event.getResource();
  if (res != null) return res;
  
  switch (event.getEventType()) {
  case END_BATCH:
  case END_BATCH_ITEM:
  case END_DOCUMENT:
  case END_SUBDOCUMENT:
  case END_GROUP:
    res = new Ending(gen.createId());
    event.setResource(res);
    break;
  default:
    break;			
  }
  
  return res;
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-wordcount

private IResource createResource(Event event) {
  if (event == null) return null;
  
  IResource res = event.getResource();
  if (res != null) return res;
  
  switch (event.getEventType()) {
  case END_BATCH:
  case END_BATCH_ITEM:
  case END_DOCUMENT:
  case END_SUBDOCUMENT:
  case END_GROUP:
    res = new Ending(gen.createId());
    event.setResource(res);
    break;
  default:
    break;			
  }
  
  return res;
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-xsltransform

event.setResource(new RawDocument(outFile.toURI(), "UTF-8", 
    rawDoc.getSourceLocale(), rawDoc.getTargetLocale()));
} else {

代码示例来源:origin: net.sf.okapi.steps/okapi-step-bomconversion

event.setResource(new RawDocument(outFile.toURI(), rawDoc.getEncoding(), 
  rawDoc.getSourceLocale(), rawDoc.getTargetLocale()));

代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace

writer.close(); writer = null;
event.setResource(new RawDocument(outFile.toURI(), encoding,
  rawDoc.getSourceLocale(), rawDoc.getTargetLocale()));

代码示例来源:origin: net.sf.okapi.steps/okapi-step-generatesimpletm

event.setResource(new RawDocument(file.toURI(), "UTF-8", srcLang, trgLang));

代码示例来源:origin: net.sf.okapi.steps/okapi-step-wordcount

@Override
protected Event handleEndBatchItem (Event event) {
  Ending res = event.getEnding();
  if (res == null) {
    res = new Ending("");
    event.setResource(res);
  }
    
  MetricsAnnotation sma = res.getAnnotation(MetricsAnnotation.class);
  if ( sma == null ) {
    sma = new MetricsAnnotation();
    res.setAnnotation(sma);
  }
  Metrics m = sma.getMetrics();
  m.setMetric(GMX.TotalWordCount, srcBatchItemWordCount);
  srcBatchWordCount += srcBatchItemWordCount;
  
  return super.handleEndBatchItem(event);
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-wordcount

@Override
protected Event handleEndBatch (Event event) {
  Ending res = event.getEnding();
  if (res == null) {
    res = new Ending("");
    event.setResource(res);
  }
    
  MetricsAnnotation sma = res.getAnnotation(MetricsAnnotation.class);
  if (sma == null) {
    sma = new MetricsAnnotation();
    res.setAnnotation(sma);
  }
  Metrics m = sma.getMetrics();
  m.setMetric(GMX.TotalWordCount, srcBatchWordCount);
  
  return super.handleEndBatch(event);
}

代码示例来源:origin: net.sf.okapi/okapi-core

tempTextUnit.setResource(postProcessTextUnit(tempTextUnit.getTextUnit()));
filterEvents.add(tempTextUnit);

相关文章