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


Java GZIPByteSink类代码示例

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


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

示例1: writeResult

import com.bbn.bue.common.io.GZIPByteSink; //导入依赖的package包/类
@Override
public void writeResult(final List<EALScorer2015Style.Result> perDocResults,
    final File outputDir) throws IOException {
  final ImmutableAggregate2015ScoringResult result = computeAggregateScore(perDocResults);

  Files.asCharSink(new File(outputDir, "aggregateScore.txt"), Charsets.UTF_8).write(
      String
          .format("%30s:%8.2f\n", "Aggregate argument precision", result.argument().precision())
          +
          String.format("%30s:%8.2f\n", "Aggregate argument recall", result.argument().recall())
          +
          String.format("%30s:%8.2f\n\n", "Aggregate argument score", result.argument().overall())
          +
          String.format("%30s:%8.2f\n", "Aggregate linking precision",
              result.linking().precision()) +
          String.format("%30s:%8.2f\n", "Aggregate linking recall", result.linking().recall())
          +
          String.format("%30s:%8.2f\n\n", "Aggregate linking score", result.linking().overall())
          +
          String.format("%30s:%8.2f\n", "Overall score", result.overall()));

  final File jsonFile = new File(outputDir, "aggregateScore.json");
  final JacksonSerializer jacksonSerializer = JacksonSerializer.json().prettyOutput().build();
  jacksonSerializer.serializeTo(result, GZIPByteSink.gzipCompress(Files.asByteSink(jsonFile)));
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:26,代码来源:AggregateResultWriter.java

示例2: writeResult

import com.bbn.bue.common.io.GZIPByteSink; //导入依赖的package包/类
@Override
public void writeResult(final File baseOutputDir) throws IOException {
  for (final Map.Entry<String, Collection<ImmutableAggregate2015ArgScoringResult>> entry : eventTypeToArgScores
      .build().asMap().entrySet()) {
    final File jsonFile =
        new File(new File(baseOutputDir, entry.getKey()), "aggregateScore.json");
    final JacksonSerializer jacksonSerializer = JacksonSerializer.json().prettyOutput().build();
    jacksonSerializer.serializeTo(entry.getValue(),
        GZIPByteSink.gzipCompress(Files.asByteSink(jsonFile)));
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:12,代码来源:BootstrappedPerEventResultWriter.java

示例3: writeOverallArgumentScoresForTransformedResults

import com.bbn.bue.common.io.GZIPByteSink; //导入依赖的package包/类
private void writeOverallArgumentScoresForTransformedResults(
    final List<EALScorer2015Style.Result> perDocResults,
    final Function<EALScorer2015Style.ArgResult, EALScorer2015Style.ArgResult> filterFunction,
    final File outputDir) throws IOException {
  // this has a lot of repetition with writeBothScores
  // we'd like to fix this eventually
  final ImmutableList<EALScorer2015Style.ArgResult> relevantArgumentScores =
      FluentIterable.from(perDocResults).transform(GET_ARG_SCORES_ONLY)
          .transform(filterFunction)
          .toList();

  PerDocResultWriter.writeArgPerDoc(relevantArgumentScores,
      new File(outputDir, "scoresByDocument.txt"));

  final ImmutableAggregate2015ArgScoringResult argScores =
      AggregateResultWriter.computeArgScoresFromArgResults(relevantArgumentScores);

  Files.asCharSink(new File(outputDir, "aggregateScore.txt"), Charsets.UTF_8).write(
      String
          .format("%30s:%8.2f\n", "Aggregate argument precision", argScores.precision())
          +
          String.format("%30s:%8.2f\n", "Aggregate argument recall", argScores.recall())
          +
          String
              .format("%30s:%8.2f\n\n", "Aggregate argument score", argScores.overall()));

  final File jsonFile = new File(outputDir, "aggregateScore.json");
  final JacksonSerializer jacksonSerializer = JacksonSerializer.json().prettyOutput().build();
  jacksonSerializer.serializeTo(argScores, GZIPByteSink.gzipCompress(Files.asByteSink(jsonFile)));
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:31,代码来源:ByEventTypeResultWriter.java

示例4: writeArray

import com.bbn.bue.common.io.GZIPByteSink; //导入依赖的package包/类
private void writeArray(DoubleArrayList numbers, File file) throws IOException {
  final ByteSink sink = GZIPByteSink.gzipCompress(Files.asByteSink(file));
  final PrintWriter out = new PrintWriter(sink.asCharSink(Charsets.UTF_8).openBufferedStream());
  for (final DoubleCursor cursor : numbers) {
    out.println(cursor.value);
  }
  out.close();
  ;
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:10,代码来源:EAScoringObserver.java

示例5: asCompressedByteSink

import com.bbn.bue.common.io.GZIPByteSink; //导入依赖的package包/类
/**
 * Just like {@link Files#asByteSink(java.io.File, com.google.common.io.FileWriteMode...)}, but
 * decompresses the incoming data using GZIP.
 */
public static ByteSink asCompressedByteSink(File f) throws IOException {
  return GZIPByteSink.gzipCompress(Files.asByteSink(f));
}
 
开发者ID:BBN-E,项目名称:bue-common-open,代码行数:8,代码来源:FileUtils.java


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