Example usage for com.google.common.base Pair first

List of usage examples for com.google.common.base Pair first

Introduction

In this page you can find the example usage for com.google.common.base Pair first.

Prototype

A first

To view the source code for com.google.common.base Pair first.

Click Source Link

Document

The first element of the pair.

Usage

From source file:edu.stanford.nlp.util.JBLEU.java

public void run() {
    int[] result = new int[JBLEU.getSuffStatCount()];

    double avg = 0.;
    double count = 0.;
    try {/*w  w  w.j a v  a 2 s  .c om*/
        for (Pair<List<String>, List<List<String>>> pair : parseInput(filename)) {
            List<String> hyp = pair.first();
            List<List<String>> refs = pair.second();
            log(hyp);
            log(refs);
            stats(hyp, refs, result);
            double score = score(result);
            avg += (score - avg) / (count + 1);
            count += 1;
            log(score);
        }
    } catch (FileNotFoundException e) {
        throw new RuntimeIOException(e);
    }
    System.out.println(String.format("BLEU:\t%.4f", avg));
}