Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PermutationScorer.h « mert - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 33af627c5ac6d25188ee1d820671a37cdcbf88d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef __PERMUTATIONSCORER_H__
#define __PERMUTATIONSCORER_H__

#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#include <climits>
#include "Types.h"
#include "ScoreData.h"
#include "Scorer.h"
#include "Permutation.h"
#include "StatisticsBasedScorer.h"

namespace MosesTuning
{

/**
  * Permutation
 **/
class PermutationScorer: public StatisticsBasedScorer
{

public:
  PermutationScorer(const std::string &distanceMetric = "HAMMING",
                    const std::string &config = std::string());
  void setReferenceFiles(const std::vector<std::string>& referenceFiles);
  void prepareStats(size_t sid, const std::string& text, ScoreStats& entry);
  static const int SCORE_PRECISION;
  static const int SCORE_MULTFACT;

  size_t NumberOfScores() const {
    //cerr << "PermutationScorer number of scores: 1" << endl;
    //return 1;

    //cerr << "PermutationScorer number of scores: 2" << endl;
    //the second it is just a counter for the normalization of the amount of test sentences
    return 2;
  };
  bool useAlignment() const {
    //cout << "PermutationScorer::useAlignment returning true" << endl;
    return true;
  };


protected:
  statscore_t calculateScore(const std::vector<ScoreStatsType>& scores) const;
  PermutationScorer(const PermutationScorer&);
  ~PermutationScorer() {};
  PermutationScorer& operator=(const PermutationScorer&);
  int getNumberWords (const std::string & line) const;

  distanceMetricReferenceChoice_t m_refChoiceStrategy;
  distanceMetric_t m_distanceMetric;

  // data extracted from reference files
  // A vector of permutations for each reference file
  std::vector< std::vector<Permutation> > m_referencePerms;
  std::vector<size_t> m_sourceLengths;
  std::vector<std::string> m_referenceAlignments;

private:
};
//TODO need to read in floats for scores - necessary for selecting mean reference strategy and for BLEU?

}

#endif //__PERMUTATIONSCORER_H