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

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

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

Event.getTextUnit介绍

[英]Convenience method returns the IResource as a ITextUnit. The caller should confirm the Event type using isTextUnit before calling this method.
[中]便利方法将IResource作为ITextUnit返回。调用方应在调用此方法之前使用isTextUnit确认事件类型。

代码示例

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

@Override
  protected Event handleTextUnit(Event event) {

    // TODO: move to cleaner. create run method

    ITextUnit tu = event.getTextUnit();

    // return event iff tu has text, else remove tu
    if (cleaner.run(tu, targetLocale) == true) {
      return Event.NOOP_EVENT;
    } else {
      return event;
    }
  }
}

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

private void processTextUnit (Event event) {
    writer.writeTUFull(event.getTextUnit());
  }
}

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

@Override
protected Event handleTextUnit (Event event) {
  extractor.processTextUnit(event.getTextUnit());
  return event;
}

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

@Override
protected void processTextUnit (Event event) {
  // Skip non-translatable
  ITextUnit tu = event.getTextUnit();
  if ( !tu.isTranslatable() ) return;
  
  writer.handleEvent(event);
  writeTMXEntries(event.getTextUnit());
}

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

@Override
protected void processTextUnit (Event event) {
  // Skip non-translatable
  ITextUnit tu = event.getTextUnit();
  if ( !tu.isTranslatable() ) return;
  
  writer.handleEvent(event);
  writeTMXEntries(event.getTextUnit());
}

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

@Override
protected void processTextUnit(Event event) {
  // Skip non-translatable
  ITextUnit tu = event.getTextUnit();
  if (!tu.isTranslatable())
    return;
  writer.handleEvent(event);
  writeTMXEntries(event.getTextUnit());
}

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

@Override
protected void processTextUnit (Event event) {
  // Skip non-translatable
  ITextUnit tu = event.getTextUnit();
  if ( !tu.isTranslatable() ) return;
  
  potWriter.handleEvent(event);
  trgWriter.handleEvent(event);
  writeTMXEntries(event.getTextUnit());
}

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

@Override
protected void processTextUnit (Event event) {
  // Skip non-translatable
  ITextUnit tu = event.getTextUnit();
  if ( !tu.isTranslatable() ) return;
  
  writer.handleEvent(event);
}

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

@Override
protected void processTextUnit (Event event) {
  layerWriter.writeEvent(event);
  writeTMXEntries(event.getTextUnit());
}

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

@Override
protected void processTextUnit (Event event) {
  // XLIFF
  event = writer.handleEvent(event);
  // TMX files
  writeTMXEntries(event.getTextUnit());
  // Check if it has been segmented (if not set already)
  if ( !preSegmented ) {
    preSegmented = event.getTextUnit().getSource().hasBeenSegmented();
  }
}

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

@Override
protected void processTextUnit (Event event) {
  ITextUnit tu = event.getTextUnit();
  if ( tu.isReferent() ) {
    storeReferent(tu);
  }
  Unit unit = toXLIFF2Unit(tu);
  writer.writeUnit(unit);
  writeTMXEntries(event.getTextUnit());
}

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

private void indexEvent(LocaleId targetLang, ITmWriter tmWriter, Event event) throws IOException {
  TranslationUnit tu;
  if (event.getEventType() == EventType.TEXT_UNIT) {
    tu = PensieveUtil.convertToTranslationUnit(sourceLang, targetLang, event.getTextUnit());
    tmWriter.indexTranslationUnit(tu);
  }
}

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

@Override
  protected Event handleTextUnit(Event event) {
    initFilter();
    if (tuFilter.accept(event.getTextUnit())) {
      return processFiltered(event);
    }
    else
      return event;
  }    
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-idml

private void handleTextUnitEvent(Event event) {
  ReferenceableEvent referenceableEvent = new ReferenceableEvent(event.getTextUnit().getId(), event);
  addReferenceableEvent(referenceableEvent);
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-idml

private void writeTextUnitReferenceableEvent(ReferenceableEvent referenceableEvent) {
  referenceableEventMerger.merge(referenceableEvent);
  StyledTextSkeleton skeleton = (StyledTextSkeleton) referenceableEvent.getEvent().getTextUnit().getSkeleton();
  events.addAll(storyChildElementsWriter.write(skeleton.getStoryChildElements()));
}

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

@Override
protected Event handleTextUnit (Event event) {
  ITextUnit tu = event.getTextUnit();
  // Skip non-translatable
  if ( !tu.isTranslatable() ) return event;
  TextContainer tc = tu.createTarget(targetLocale, false, IResource.COPY_ALL);
  for ( TextPart part : tc ) {
    processFragment(part.getContent());
  }
  return event;
}

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

@Override
protected Event handleTextUnit(Event event) {
  ITextUnit tu = event.getTextUnit();
  String r = null;
  if (rules != null) {
    r = rules.getRules();
  }
  TextUnitUtil.simplifyCodes(tu, r, params.getRemoveLeadingTrailingCodes() && tu.getSkeleton() instanceof GenericSkeleton, params.getMergeCodes());
  
  //TextUnitUtil.convertTextParts(tu.getSource());
  return super.handleTextUnit(event);
}

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

@Override
  protected Event handleTextUnit(Event event) {
    new WhitespaceCorrector(sourceLocale, targetLocale,
            getParameters().getPunctuation(), getParameters().getWhitespace()).correctWhitespace(event.getTextUnit());
    return event;
  }
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-versifiedtxt

private ITextUnit buildTextUnit(String source, String target, boolean targetTag, boolean trados) {
  ITextUnit tu = eventBuilder.peekTempEvent().getTextUnit();
  source = replacePlacebles(source);
  target = replacePlacebles(target);
  
  if (trados) {
    tu = buildTextUnitForTrados(source);
  } else {
    buildTextUnitForNonTrados(source, true);
    if (targetTag) {
      buildTextUnitForNonTrados(target, false);
    }
  }
  
  return tu;
}

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

@Override
protected Event handleTextUnit(Event event) {
  ITextUnit tu = event.getTextUnit();
  String r = null;
  if (rules != null) {
    r = rules.getRules();
  }
  boolean segmentation = MimeTypeMapper.isSegmentationSupported(tu.getMimeType());
  // don't trim codes for segmented formats like XLIFF as this changes the segment boundaries from the original
  if (!segmentation) {
    TextUnitUtil.simplifyCodesPostSegmentation(tu, r, params.getRemoveLeadingTrailingCodes(), params.getMergeCodes());            
  }
  return super.handleTextUnit(event);
}

相关文章