mosesdecoder/contrib/other-builds/moses2/Scores.h

86 lines
2.1 KiB
C
Raw Normal View History

2015-10-23 22:53:36 +03:00
/*
* Scores.h
*
* Created on: 23 Oct 2015
* Author: hieu
*/
#pragma once
2015-10-26 19:32:47 +03:00
#include <iostream>
2015-10-24 04:02:50 +03:00
#include <string>
2015-10-23 22:53:36 +03:00
#include "TypeDef.h"
2015-10-28 19:11:12 +03:00
#include "MemPool.h"
2015-12-11 00:21:52 +03:00
#include "Vector.h"
2015-10-23 22:53:36 +03:00
2015-12-10 23:49:30 +03:00
namespace Moses2
{
2015-10-24 04:02:50 +03:00
class FeatureFunction;
2015-10-28 19:33:08 +03:00
class FeatureFunctions;
2015-10-26 00:20:55 +03:00
class System;
2015-10-24 04:02:50 +03:00
2016-03-31 23:00:16 +03:00
class Scores
{
friend std::ostream& operator<<(std::ostream &, const Scores &);
2015-10-23 22:53:36 +03:00
public:
2015-12-01 02:03:33 +03:00
Scores(const System &system, MemPool &pool, size_t numScores);
2016-03-31 23:00:16 +03:00
Scores(const System &system, MemPool &pool, size_t numScores,
const Scores &origScores);
2015-10-24 16:36:30 +03:00
virtual ~Scores();
2015-10-23 22:53:36 +03:00
2015-10-27 02:24:58 +03:00
SCORE GetTotalScore() const
2016-03-31 23:00:16 +03:00
{
return m_total;
}
2015-10-27 02:24:58 +03:00
void Reset(const System &system);
2015-11-02 17:06:03 +03:00
2015-10-29 20:21:54 +03:00
void CreateFromString(const std::string &str,
2016-03-31 23:00:16 +03:00
const FeatureFunction &featureFunction, const System &system,
bool transformScores);
2015-10-24 16:36:30 +03:00
2016-03-31 23:00:16 +03:00
void PlusEquals(const System &system, const FeatureFunction &featureFunction,
const SCORE &score);
2015-10-29 15:47:53 +03:00
2016-03-31 23:00:16 +03:00
void PlusEquals(const System &system, const FeatureFunction &featureFunction,
const SCORE &score, size_t offset);
2015-12-18 00:43:02 +03:00
2016-03-31 23:00:16 +03:00
void PlusEquals(const System &system, const FeatureFunction &featureFunction,
const std::vector<SCORE> &scores);
2015-10-29 15:47:53 +03:00
2016-03-31 23:00:16 +03:00
void PlusEquals(const System &system, const FeatureFunction &featureFunction,
const Vector<SCORE> &scores);
2015-12-11 00:21:52 +03:00
2016-03-31 23:00:16 +03:00
void PlusEquals(const System &system, const FeatureFunction &featureFunction,
SCORE scores[]);
2015-12-11 00:47:41 +03:00
2016-03-31 23:00:16 +03:00
void PlusEquals(const System &system, const Scores &scores);
2015-10-28 19:33:08 +03:00
2016-03-31 23:00:16 +03:00
void MinusEquals(const System &system, const Scores &scores);
2016-03-20 16:04:14 +03:00
2016-03-31 23:00:16 +03:00
void Assign(const System &system, const FeatureFunction &featureFunction,
const SCORE &score);
2015-11-04 17:54:20 +03:00
2016-03-31 23:00:16 +03:00
void Assign(const System &system, const FeatureFunction &featureFunction,
const std::vector<SCORE> &scores);
2015-11-04 17:54:20 +03:00
void Debug(std::ostream &out, const System &system) const;
2015-10-28 19:33:08 +03:00
2016-03-20 12:48:41 +03:00
void OutputBreakdownToStream(std::ostream &out, const System &system) const;
2016-03-17 20:54:25 +03:00
// static functions to work out estimated scores
static SCORE CalcWeightedScore(const System &system,
2016-03-31 23:00:16 +03:00
const FeatureFunction &featureFunction, SCORE scores[]);
static SCORE CalcWeightedScore(const System &system,
2016-03-31 23:00:16 +03:00
const FeatureFunction &featureFunction, SCORE score);
2015-10-23 22:53:36 +03:00
protected:
2016-03-31 23:00:16 +03:00
SCORE *m_scores;
SCORE m_total;
2015-10-23 22:53:36 +03:00
};
2015-12-10 23:49:30 +03:00
}