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


Java JacksonSerializer类代码示例

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


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

示例1: writeResult

import com.bbn.bue.common.serialization.jackson.JacksonSerializer; //导入依赖的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: finish

import com.bbn.bue.common.serialization.jackson.JacksonSerializer; //导入依赖的package包/类
public void finish() throws IOException {
  outputDir.mkdirs();

  final ImmutableSetMultimap<String, String> mentionAlignmentFailures =
      mentionAlignmentFailuresB.build();
  log.info("Of {} system responses, got {} mention alignment failures",
      numResponses.size(), mentionAlignmentFailures.size());

  final File serializedFailuresFile = new File(outputDir, "alignmentFailures.json");
  final JacksonSerializer serializer =
      JacksonSerializer.builder().forJson().prettyOutput().build();
  serializer.serializeTo(mentionAlignmentFailures, Files.asByteSink(serializedFailuresFile));

  final File failuresCount = new File(outputDir, "alignmentFailures.count.txt");
  serializer.serializeTo(mentionAlignmentFailures.size(), Files.asByteSink(failuresCount));
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:17,代码来源:ScoreKBPAgainstERE.java

示例3: finish

import com.bbn.bue.common.serialization.jackson.JacksonSerializer; //导入依赖的package包/类
@Override
public void finish() throws IOException {
  final CharSink textSink = Files.asCharSink(new File(outputDir, outputName + FILE_SUFFIX),
      Charsets.UTF_8);
  final ByteSink jsonSink = Files.asByteSink(new File(outputDir, outputName + FILE_SUFFIX + ".json"));

  final SummaryConfusionMatrix summaryConfusionMatrix = summaryConfusionMatrixB.build();
  // Output the summaries and add a final newline
  final FMeasureCounts fMeasure =
      SummaryConfusionMatrices.FMeasureVsAllOthers(summaryConfusionMatrix, PRESENT);
  textSink.write(StringUtils.NewlineJoiner.join(
      SummaryConfusionMatrices.prettyPrint(summaryConfusionMatrix),
      fMeasure.compactPrettyString(),
      ""));  // Empty string creates a bare newline at the end
  JacksonSerializer.builder().forJson().prettyOutput().build().serializeTo(fMeasure, jsonSink);

  // Call finish on the observers
  for (final ScoringEventObserver observer : scoringEventObservers) {
    observer.finish(outputDir);
  }
}
 
开发者ID:BBN-E,项目名称:bue-common-open,代码行数:22,代码来源:AggregateBinaryFScoresInspector.java

示例4: writeResult

import com.bbn.bue.common.serialization.jackson.JacksonSerializer; //导入依赖的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

示例5: writeOverallArgumentScoresForTransformedResults

import com.bbn.bue.common.serialization.jackson.JacksonSerializer; //导入依赖的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


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