Package joshua.zmert

Examples of joshua.zmert.BLEU


    // Setup the EvaluationMetric class
    EvaluationMetric.set_numSentences(0);
    EvaluationMetric.set_refsPerSen(1);
    EvaluationMetric.set_refSentences(null);

    BLEU bleu = new BLEU();
   
    Assert.assertEquals(bleu.get_metricName(), "BLEU");

  }
View Full Code Here


    // Setup the EvaluationMetric class
    EvaluationMetric.set_numSentences(0);
    EvaluationMetric.set_refsPerSen(1);
    EvaluationMetric.set_refSentences(null);

    BLEU bleu = new BLEU();
   
    // Default constructor should use a maximum n-gram length of 4
    Assert.assertEquals(bleu.maxGramLength, 4);
   
    // Default constructor should use the closest reference
View Full Code Here

   
    EvaluationMetric.set_numSentences(1);
    EvaluationMetric.set_refsPerSen(1);
    EvaluationMetric.set_refSentences(refSentences);
   
    BLEU bleu = new BLEU();
   
    // testSentences[i] stores the candidate translation for the i'th sentence
    String[] testSentences = new String[1];
    testSentences[0] = test;
    try {
      // Check BLEU score matches
      double actualScore = bleu.score(testSentences);
      double expectedScore = 0.2513;
      double acceptableScoreDelta = 0.00001f;

      Assert.assertEquals(actualScore, expectedScore, acceptableScoreDelta);

      // Check sufficient statistics match
      int[] actualSS = bleu.suffStats(testSentences);
      int[] expectedSS = {14,27,8,26,5,25,3,24,27,23};

      Assert.assertEquals(actualSS[0], expectedSS[0], 0); // 1-gram matches
      Assert.assertEquals(actualSS[1], expectedSS[1], 0); // 1-gram total
      Assert.assertEquals(actualSS[2], expectedSS[2], 0); // 2-gram matches
View Full Code Here

TOP

Related Classes of joshua.zmert.BLEU

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.