mosesdecoder/moses2/EstimatedScores.h

60 lines
1.8 KiB
C
Raw Normal View History

2016-02-09 18:36:53 +03:00
// $Id$
/***********************************************************************
2016-03-31 23:00:16 +03:00
Moses - factored phrase-based language decoder
Copyright (C) 2006 University of Edinburgh
2016-02-09 18:36:53 +03:00
2016-03-31 23:00:16 +03:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
2016-02-09 18:36:53 +03:00
2016-03-31 23:00:16 +03:00
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
2016-02-09 18:36:53 +03:00
2016-03-31 23:00:16 +03:00
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************/
2016-02-09 18:36:53 +03:00
#pragma once
#include <iostream>
#include "legacy/Util2.h"
#include "legacy/Bitmap.h"
2016-02-13 18:35:35 +03:00
#include "legacy/Matrix.h"
2016-02-09 18:36:53 +03:00
namespace Moses2
{
2016-02-09 20:12:20 +03:00
class MemPool;
2016-06-11 00:03:11 +03:00
class System;
2016-02-09 20:12:20 +03:00
2016-02-09 18:36:53 +03:00
//! A square array of floats to store future costs in the phrase-based decoder
2016-03-31 23:00:16 +03:00
class EstimatedScores: public Matrix<float>
2016-02-09 18:36:53 +03:00
{
public:
2016-03-31 23:00:16 +03:00
EstimatedScores(MemPool &pool, size_t size) :
2017-02-01 03:10:16 +03:00
Matrix<float>(pool, size, size) {
2016-03-31 23:00:16 +03:00
}
2016-02-09 18:36:53 +03:00
2016-02-09 20:12:20 +03:00
~EstimatedScores(); // not implemented
2016-03-31 23:00:16 +03:00
float CalcEstimatedScore(Bitmap const&) const;
float CalcEstimatedScore(Bitmap const&, size_t startPos, size_t endPos) const;
2016-02-09 18:36:53 +03:00
2017-02-01 03:10:16 +03:00
std::ostream &Debug(std::ostream &out, const System &system) const {
2016-06-11 00:03:11 +03:00
for (size_t endPos = 0; endPos < GetSize(); endPos++) {
for (size_t startPos = 0; startPos < GetSize(); startPos++)
out << GetValue(startPos, endPos) << " ";
out << std::endl;
}
2016-06-18 01:06:02 +03:00
return out;
2016-02-09 18:36:53 +03:00
}
2016-06-11 00:03:11 +03:00
};
2016-02-09 18:36:53 +03:00
}