Beispiel #1
0
 /**
  * Get the Meteor sufficient statistics for a test / reference pair
  *
  * @param test
  * @param reference
  * @return
  */
 public MeteorStats getMeteorStats(String test, String reference) {
   // Normalize both
   if (normalize) {
     test = Normalizer.normalizeLine(test, langID, keepPunctuation);
     reference = Normalizer.normalizeLine(reference, langID, keepPunctuation);
   }
   // Lowercase both
   if (lowerCase) {
     test = test.toLowerCase();
     reference = reference.toLowerCase();
   }
   // Score
   Alignment alignment = aligner.align(test, reference);
   return getMeteorStats(alignment);
 }
Beispiel #2
0
 /**
  * Get the Meteor sufficient statistics for a test give a list of references
  *
  * @param test
  * @param references
  * @return
  */
 public MeteorStats getMeteorStats(String test, ArrayList<String> references) {
   // Normalize test
   if (normalize) test = Normalizer.normalizeLine(test, langID, keepPunctuation);
   if (lowerCase) test = test.toLowerCase();
   MeteorStats stats = new MeteorStats();
   stats.score = -1;
   // Score each reference
   for (String reference : references) {
     // Normalize reference
     if (normalize) reference = Normalizer.normalizeLine(reference, langID, keepPunctuation);
     if (lowerCase) reference = reference.toLowerCase();
     Alignment alignment = aligner.align(test, reference);
     MeteorStats curStats = getMeteorStats(alignment);
     if (curStats.score > stats.score) stats = curStats;
   }
   return stats;
 }
Beispiel #3
0
 /**
  * Get stats when test and reference are already tokenized and normalized (Make sure you know what
  * you're doing)
  *
  * @param test
  * @param reference
  * @return
  */
 public MeteorStats getMeteorStats(ArrayList<String> test, ArrayList<String> reference) {
   Alignment alignment = aligner.align(test, reference);
   return getMeteorStats(alignment);
 }