delete class TranslationSystem

This commit is contained in:
Hieu Hoang 2013-05-11 14:13:26 +01:00
parent b75d194833
commit 981351758a
51 changed files with 96 additions and 287 deletions

View File

@ -1046,16 +1046,6 @@
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationOptionList.h</locationURI>
</link>
<link>
<name>TranslationSystem.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationSystem.cpp</locationURI>
</link>
<link>
<name>TranslationSystem.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationSystem.h</locationURI>
</link>
<link>
<name>TreeInput.cpp</name>
<type>1</type>

View File

@ -10,7 +10,6 @@
#include "moses/Manager.h"
#include "moses/StaticData.h"
#include "moses/TranslationModel/PhraseDictionaryDynSuffixArray.h"
#include "moses/TranslationSystem.h"
#include "moses/TreeInput.h"
#include "moses/LMList.h"
#include "moses/LM/ORLM.h"
@ -24,18 +23,6 @@ using namespace std;
typedef std::map<std::string, xmlrpc_c::value> params_t;
/** Find out which translation system to use */
const TranslationSystem& getTranslationSystem(params_t params)
{
string system_id = TranslationSystem::DEFAULT;
params_t::const_iterator pi = params.find("system");
if (pi != params.end()) {
system_id = xmlrpc_c::value_string(pi->second);
}
VERBOSE(1, "Using translation system " << system_id << endl;)
return StaticData::Instance().GetTranslationSystem(system_id);
}
class Updater: public xmlrpc_c::method
{
public:
@ -174,7 +161,6 @@ public:
(const_cast<StaticData&>(staticData)).SetOutputSearchGraph(true);
}
const TranslationSystem& system = getTranslationSystem(params);
stringstream out, graphInfo, transCollOpts;
map<string, xmlrpc_c::value> retData;
@ -184,7 +170,7 @@ public:
staticData.GetInputFactorOrder();
stringstream in(source + "\n");
tinput.Read(in,inputFactorOrder);
ChartManager manager(tinput, &system);
ChartManager manager(tinput);
manager.ProcessSentence();
const ChartHypothesis *hypo = manager.GetBestHypothesis();
outputChartHypo(out,hypo);
@ -195,7 +181,7 @@ public:
stringstream in(source + "\n");
sentence.Read(in,inputFactorOrder);
size_t lineNumber = 0; // TODO: Include sentence request number here?
Manager manager(lineNumber, sentence, staticData.GetSearchAlgorithm(), &system);
Manager manager(lineNumber, sentence, staticData.GetSearchAlgorithm());
manager.ProcessSentence();
const Hypothesis* hypo = manager.GetBestHypothesis();

View File

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "moses/ChartManager.h"
#include "moses/Sentence.h"
#include "moses/InputType.h"
#include "moses/TranslationSystem.h"
#include "moses/Phrase.h"
#include "moses/TrellisPathList.h"
#include "moses/ChartTrellisPathList.h"
@ -74,7 +73,6 @@ namespace Mira {
}
delete[] mosesargv;
const StaticData &staticData = StaticData::Instance();
//m_bleuScoreFeature = staticData.GetBleuScoreFeature(); TODO
assert(false);
}
@ -106,19 +104,17 @@ namespace Mira {
StaticData &staticData = StaticData::InstanceNonConst();
bool chartDecoding = (staticData.GetSearchAlgorithm() == ChartDecoding);
initialize(staticData, source, sentenceid, bleuObjectiveWeight, bleuScoreWeight, avgRefLength, chartDecoding);
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
// run the decoder
if (chartDecoding) {
return runChartDecoder(source, sentenceid, nBestSize, bleuObjectiveWeight, bleuScoreWeight,
featureValues, bleuScores, modelScores, numReturnedTranslations, realBleu, distinct, rank, epoch,
system);
featureValues, bleuScores, modelScores, numReturnedTranslations, realBleu, distinct, rank, epoch);
}
else {
SearchAlgorithm search = staticData.GetSearchAlgorithm();
return runDecoder(source, sentenceid, nBestSize, bleuObjectiveWeight, bleuScoreWeight,
featureValues, bleuScores, modelScores, numReturnedTranslations, realBleu, distinct, rank, epoch,
search, system, filename);
search, filename);
}
}
@ -136,10 +132,9 @@ namespace Mira {
size_t rank,
size_t epoch,
SearchAlgorithm& search,
const TranslationSystem& system,
string filename) {
// run the decoder
m_manager = new Moses::Manager(0,*m_sentence, search, &system);
m_manager = new Moses::Manager(0,*m_sentence, search);
m_manager->ProcessSentence();
TrellisPathList nBestList;
m_manager->CalcNBest(nBestSize, nBestList, distinct);
@ -153,7 +148,7 @@ namespace Mira {
throw runtime_error(msg.str());
}
// TODO: handle sentence id (for now always 0)
//OutputNBest(out, nBestList, StaticData::Instance().GetOutputFactorOrder(),m_manager->GetTranslationSystem(), 0, false);
//OutputNBest(out, nBestList, StaticData::Instance().GetOutputFactorOrder(), 0, false);
out.close();
}
@ -213,10 +208,9 @@ namespace Mira {
bool realBleu,
bool distinct,
size_t rank,
size_t epoch,
const TranslationSystem& system) {
size_t epoch) {
// run the decoder
m_chartManager = new ChartManager(*m_sentence, &system);
m_chartManager = new ChartManager(*m_sentence);
m_chartManager->ProcessSentence();
ChartTrellisPathList nBestList;
m_chartManager->CalcNBest(nBestSize, nBestList, distinct);
@ -271,10 +265,9 @@ namespace Mira {
StaticData &staticData = StaticData::InstanceNonConst();
bool chartDecoding = (staticData.GetSearchAlgorithm() == ChartDecoding);
initialize(staticData, source, sentenceid, bleuObjectiveWeight, bleuScoreWeight, avgRefLength, chartDecoding);
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
if (chartDecoding) {
m_chartManager = new ChartManager(*m_sentence, &system);
m_chartManager = new ChartManager(*m_sentence);
m_chartManager->ProcessSentence();
ChartTrellisPathList nBestList;
m_chartManager->CalcNBest(nBestSize, nBestList, distinctNbest);
@ -300,7 +293,7 @@ namespace Mira {
}
else {
// run the decoder
m_manager = new Moses::Manager(0,*m_sentence, staticData.GetSearchAlgorithm(), &system);
m_manager = new Moses::Manager(0,*m_sentence, staticData.GetSearchAlgorithm());
m_manager->ProcessSentence();
TrellisPathList nBestList;
m_manager->CalcNBest(nBestSize, nBestList, distinctNbest);

View File

@ -79,7 +79,6 @@ class MosesDecoder {
size_t rank,
size_t epoch,
Moses::SearchAlgorithm& seach,
const Moses::TranslationSystem& system,
std::string filename);
std::vector< std::vector<const Moses::Word*> > runChartDecoder(const std::string& source,
size_t sentenceid,
@ -93,8 +92,7 @@ class MosesDecoder {
bool realBleu,
bool distinct,
size_t rank,
size_t epoch,
const Moses::TranslationSystem& system);
size_t epoch);
void outputNBestList(const std::string& source,
size_t sentenceid,
size_t nBestSize,

View File

@ -399,7 +399,7 @@ void IOWrapper::OutputBestNone(long translationId) {
}
}
void IOWrapper::OutputAllFeatureScores(const TranslationSystem &system, const ScoreComponentCollection &features, std::ostream &out)
void IOWrapper::OutputAllFeatureScores(const ScoreComponentCollection &features, std::ostream &out)
{
std::string lastName = "";
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();
@ -461,7 +461,7 @@ void IOWrapper::OutputFeatureScores( std::ostream& out, const ScoreComponentColl
}
}
void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const TranslationSystem* system, long translationId) {
void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, long translationId) {
std::ostringstream out;
// Check if we're writing to std::cout.
@ -497,7 +497,7 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Tra
// before each model type, the corresponding command-line-like name must be emitted
// MERT script relies on this
OutputAllFeatureScores(*system, path.GetScoreBreakdown(), out);
OutputAllFeatureScores(path.GetScoreBreakdown(), out);
// total
out << " ||| " << path.GetTotalScore();
@ -546,7 +546,7 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Tra
m_nBestOutputCollector->Write(translationId, out.str());
}
void IOWrapper::OutputNBestList(const std::vector<search::Applied> &nbest, const TranslationSystem &system, long translationId) {
void IOWrapper::OutputNBestList(const std::vector<search::Applied> &nbest, long translationId) {
std::ostringstream out;
// wtf? copied from the original OutputNBestList
if (m_nBestOutputCollector->OutputIsCout()) {
@ -555,7 +555,7 @@ void IOWrapper::OutputNBestList(const std::vector<search::Applied> &nbest, const
Phrase outputPhrase;
ScoreComponentCollection features;
for (std::vector<search::Applied>::const_iterator i = nbest.begin(); i != nbest.end(); ++i) {
Incremental::PhraseAndFeatures(system, *i, outputPhrase, features);
Incremental::PhraseAndFeatures(*i, outputPhrase, features);
// <s> and </s>
CHECK(outputPhrase.GetSize() >= 2);
outputPhrase.RemoveWord(0);
@ -563,7 +563,7 @@ void IOWrapper::OutputNBestList(const std::vector<search::Applied> &nbest, const
out << translationId << " ||| ";
OutputSurface(out, outputPhrase, m_outputFactorOrder, false);
out << " ||| ";
OutputAllFeatureScores(system, features, out);
OutputAllFeatureScores(features, out);
out << " ||| " << i->GetScore() << '\n';
}
out << std::flush;

View File

@ -40,7 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "moses/TypeDef.h"
#include "moses/Sentence.h"
#include "moses/FactorTypeSet.h"
#include "moses/TranslationSystem.h"
#include "moses/ChartTrellisPathList.h"
#include "moses/OutputCollector.h"
#include "moses/ChartHypothesis.h"
@ -51,7 +50,6 @@ namespace Moses
{
class FactorCollection;
class ChartTrellisPathList;
class TranslationSystem;
class ScoreComponentCollection;
}
@ -92,8 +90,7 @@ protected:
void WriteApplicationContext(std::ostream &out,
const ApplicationContext &context);
void OutputAllFeatureScores(const Moses::TranslationSystem &system
, const Moses::ScoreComponentCollection &features
void OutputAllFeatureScores(const Moses::ScoreComponentCollection &features
, std::ostream &out);
void OutputFeatureScores( std::ostream& out
, const Moses::ScoreComponentCollection &features
@ -114,8 +111,8 @@ public:
void OutputBestHypo(search::Applied applied, long translationId);
void OutputBestHypo(const std::vector<const Moses::Factor*>& mbrBestHypo, long translationId);
void OutputBestNone(long translationId);
void OutputNBestList(const Moses::ChartTrellisPathList &nBestList, const Moses::TranslationSystem* system, long translationId);
void OutputNBestList(const std::vector<search::Applied> &nbest, const Moses::TranslationSystem &system, long translationId);
void OutputNBestList(const Moses::ChartTrellisPathList &nBestList, long translationId);
void OutputNBestList(const std::vector<search::Applied> &nbest, long translationId);
void OutputDetailedTranslationReport(const Moses::ChartHypothesis *hypo, const Moses::Sentence &sentence, long translationId);
void Backtrack(const Moses::ChartHypothesis *hypo);

View File

@ -91,13 +91,12 @@ public:
void Run() {
const StaticData &staticData = StaticData::Instance();
const TranslationSystem &system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const size_t translationId = m_source->GetTranslationId();
VERBOSE(2,"\nTRANSLATING(" << translationId << "): " << *m_source);
if (staticData.GetSearchAlgorithm() == ChartIncremental) {
Incremental::Manager manager(*m_source, system);
Incremental::Manager manager(*m_source);
const std::vector<search::Applied> &nbest = manager.ProcessSentence();
if (!nbest.empty()) {
m_ioWrapper.OutputBestHypo(nbest[0], translationId);
@ -105,11 +104,11 @@ public:
m_ioWrapper.OutputBestNone(translationId);
}
if (staticData.GetNBestSize() > 0)
m_ioWrapper.OutputNBestList(nbest, system, translationId);
m_ioWrapper.OutputNBestList(nbest, translationId);
return;
}
ChartManager manager(*m_source, &system);
ChartManager manager(*m_source);
manager.ProcessSentence();
CHECK(!staticData.UseMBR());
@ -136,7 +135,7 @@ public:
VERBOSE(2,"WRITING " << nBestSize << " TRANSLATION ALTERNATIVES TO " << staticData.GetNBestFilePath() << endl);
ChartTrellisPathList nBestList;
manager.CalcNBest(nBestSize, nBestList,staticData.GetDistinctNBest());
m_ioWrapper.OutputNBestList(nBestList, &system, translationId);
m_ioWrapper.OutputNBestList(nBestList, translationId);
IFVERBOSE(2) {
PrintUserTime("N-Best Hypotheses Generation Time:");
}
@ -209,7 +208,6 @@ static void ShowWeights()
{
fix(cout,6);
const StaticData& staticData = StaticData::Instance();
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions();
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();

View File

@ -380,7 +380,6 @@ void IOWrapper::OutputBestHypo(const Hypothesis *hypo, long /*translationId*/, b
void OutputNBest(std::ostream& out
, const Moses::TrellisPathList &nBestList
, const std::vector<Moses::FactorType>& outputFactorOrder
, const TranslationSystem &system
, long translationId
, bool reportSegmentation)
{
@ -404,7 +403,7 @@ void OutputNBest(std::ostream& out
out << " |||";
// print scores with feature names
OutputAllFeatureScores( system, path.GetScoreBreakdown(), out );
OutputAllFeatureScores(path.GetScoreBreakdown(), out );
// total
out << " ||| " << path.GetTotalScore();
@ -453,9 +452,8 @@ void OutputNBest(std::ostream& out
out << std::flush;
}
void OutputAllFeatureScores(const Moses::TranslationSystem &system
, const Moses::ScoreComponentCollection &features
, std::ostream &out)
void OutputAllFeatureScores(const Moses::ScoreComponentCollection &features
, std::ostream &out)
{
std::string lastName = "";
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();

View File

@ -55,7 +55,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace Moses
{
class TranslationSystem;
class ScoreComponentCollection;
}
@ -145,11 +144,9 @@ void OutputAlignment(std::ostream &out, const Moses::Hypothesis *hypo);
void OutputNBest(std::ostream& out
, const Moses::TrellisPathList &nBestList
, const std::vector<Moses::FactorType>& outputFactorOrder
, const Moses::TranslationSystem &system
, long translationId
, bool reportSegmentation);
void OutputAllFeatureScores(const Moses::TranslationSystem &system
, const Moses::ScoreComponentCollection &features
void OutputAllFeatureScores(const Moses::ScoreComponentCollection &features
, std::ostream &out);
void OutputFeatureScores( std::ostream& out
, const Moses::ScoreComponentCollection &features

View File

@ -179,8 +179,7 @@ int main(int argc, char* argv[])
while(ReadInput(*ioWrapper,staticData.GetInputType(),source)) {
++lineCount;
Sentence sentence;
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
Manager manager(lineCount, *source, staticData.GetSearchAlgorithm(), &system);
Manager manager(lineCount, *source, staticData.GetSearchAlgorithm());
manager.ProcessSentence();
TrellisPathList nBestList;
manager.CalcNBest(nBestSize, nBestList,true);

View File

@ -118,13 +118,11 @@ public:
const StaticData &staticData = StaticData::Instance();
// input sentence
Sentence sentence();
// set translation system
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
// execute the translation
// note: this executes the search, resulting in a search graph
// we still need to apply the decision rule (MAP, MBR, ...)
Manager manager(m_lineNumber, *m_source,staticData.GetSearchAlgorithm(), &system);
Manager manager(m_lineNumber, *m_source,staticData.GetSearchAlgorithm());
manager.ProcessSentence();
// output word graph
@ -381,7 +379,7 @@ public:
TrellisPathList nBestList;
ostringstream out;
manager.CalcNBest(staticData.GetNBestSize(), nBestList,staticData.GetDistinctNBest());
OutputNBest(out, nBestList, staticData.GetOutputFactorOrder(), *manager.GetTranslationSystem(), m_lineNumber,
OutputNBest(out, nBestList, staticData.GetOutputFactorOrder(), m_lineNumber,
staticData.GetReportSegmentation());
m_nbestCollector->Write(m_lineNumber, out.str());
}
@ -391,7 +389,7 @@ public:
TrellisPathList latticeSamples;
ostringstream out;
manager.CalcLatticeSamples(staticData.GetLatticeSamplesSize(), latticeSamples);
OutputNBest(out,latticeSamples, staticData.GetOutputFactorOrder(), *manager.GetTranslationSystem(), m_lineNumber,
OutputNBest(out,latticeSamples, staticData.GetOutputFactorOrder(), m_lineNumber,
staticData.GetReportSegmentation());
m_latticeSamplesCollector->Write(m_lineNumber, out.str());
}
@ -400,7 +398,7 @@ public:
if (m_detailedTranslationCollector) {
ostringstream out;
fix(out,PRECISION);
TranslationAnalysis::PrintTranslationAnalysis(manager.GetTranslationSystem(), out, manager.GetBestHypothesis());
TranslationAnalysis::PrintTranslationAnalysis(out, manager.GetBestHypothesis());
m_detailedTranslationCollector->Write(m_lineNumber,out.str());
}
@ -470,7 +468,6 @@ static void ShowWeights()
//TODO: Find a way of ensuring this order is synced with the nbest
fix(cout,6);
const StaticData& staticData = StaticData::Instance();
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions();
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();
@ -517,7 +514,6 @@ void OutputFeatureWeightsForHypergraph(std::ostream &outputSearchGraphStream)
outputSearchGraphStream.precision(6);
const StaticData& staticData = StaticData::Instance();
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const vector<const StatelessFeatureFunction*>& slf =StatelessFeatureFunction::GetStatelessFeatureFunctions();
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();
size_t featureIndex = 1;

View File

@ -12,7 +12,7 @@ using namespace Moses;
namespace TranslationAnalysis
{
void PrintTranslationAnalysis(const TranslationSystem* system, std::ostream &os, const Hypothesis* hypo)
void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo)
{
os << std::endl << "TRANSLATION HYPOTHESIS DETAILS:" << std::endl;
std::vector<const Hypothesis*> translationPath;

View File

@ -9,7 +9,6 @@
#include <iostream>
#include "moses/Hypothesis.h"
#include "moses/TranslationSystem.h"
namespace TranslationAnalysis
{
@ -18,7 +17,7 @@ namespace TranslationAnalysis
* print details about the translation represented in hypothesis to
* os. Included information: phrase alignment, words dropped, scores
*/
void PrintTranslationAnalysis(const Moses::TranslationSystem* system, std::ostream &os, const Moses::Hypothesis* hypo);
void PrintTranslationAnalysis(std::ostream &os, const Moses::Hypothesis* hypo);
}

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "HypothesisStackCubePruning.h"
#include "DummyScoreProducers.h"
#include "TranslationOptionList.h"
#include "TranslationSystem.h"
namespace Moses
{
@ -52,11 +51,10 @@ public:
class HypothesisScoreOrdererWithDistortion
{
public:
HypothesisScoreOrdererWithDistortion(const WordsRange* transOptRange, const TranslationSystem* system) :
m_transOptRange(transOptRange), m_system(system) {}
HypothesisScoreOrdererWithDistortion(const WordsRange* transOptRange) :
m_transOptRange(transOptRange) {}
const WordsRange* m_transOptRange;
const TranslationSystem* m_system;
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const {
CHECK(m_transOptRange != NULL);
@ -112,8 +110,7 @@ BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
, BitmapContainer &parent
, const TranslationOptionList &translations
, const SquareMatrix &futureScore,
const InputType& itype,
const TranslationSystem* system)
const InputType& itype)
: m_initialized(false)
, m_prevBitmapContainer(prevBitmapContainer)
, m_parent(parent)
@ -170,7 +167,7 @@ BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
CHECK(m_hypotheses[0]->GetTotalScore() >= m_hypotheses[1]->GetTotalScore());
}
HypothesisScoreOrdererWithDistortion orderer (&transOptRange, system);
HypothesisScoreOrdererWithDistortion orderer (&transOptRange);
std::sort(m_hypotheses.begin(), m_hypotheses.end(), orderer);
// std::sort(m_hypotheses.begin(), m_hypotheses.end(), HypothesisScoreOrdererNoDistortion());

View File

@ -181,8 +181,7 @@ public:
, BitmapContainer &parent
, const TranslationOptionList &translations
, const SquareMatrix &futureScore,
const InputType& source,
const TranslationSystem* system);
const InputType& source);
~BackwardsEdge();
bool GetInitialized();

View File

@ -44,13 +44,12 @@ extern bool g_debug;
* \param source the sentence to be decoded
* \param system which particular set of models to use.
*/
ChartManager::ChartManager(InputType const& source, const TranslationSystem* system)
ChartManager::ChartManager(InputType const& source)
:m_source(source)
,m_hypoStackColl(source, *this)
,m_system(system)
,m_start(clock())
,m_hypothesisId(0)
,m_parser(source, *system, m_hypoStackColl)
,m_parser(source, m_hypoStackColl)
,m_translationOptionList(StaticData::Instance().GetRuleLimit())
{
}

View File

@ -28,7 +28,6 @@
#include "InputType.h"
#include "WordsRange.h"
#include "SentenceStats.h"
#include "TranslationSystem.h"
#include "ChartTranslationOptionList.h"
#include "ChartParser.h"
@ -58,7 +57,6 @@ private:
InputType const& m_source; /**< source sentence to be translated */
ChartCellCollection m_hypoStackColl;
std::auto_ptr<SentenceStats> m_sentenceStats;
const TranslationSystem* m_system;
clock_t m_start; /**< starting time, used for logging */
unsigned m_hypothesisId; /* For handing out hypothesis ids to ChartHypothesis */
@ -73,7 +71,7 @@ private:
void PreCalculateScores();
public:
ChartManager(InputType const& source, const TranslationSystem* system);
ChartManager(InputType const& source);
~ChartManager();
void ProcessSentence();
void AddXmlChartOptions();
@ -88,11 +86,6 @@ public:
return m_source;
}
//! which particular set of models is in use
const TranslationSystem* GetTranslationSystem() const {
return m_system;
}
//! debug data collected when decoding sentence
SentenceStats& GetSentenceStats() const {
return *m_sentenceStats;

View File

@ -33,7 +33,7 @@ namespace Moses
{
extern bool g_debug;
ChartParserUnknown::ChartParserUnknown(const TranslationSystem &system) : m_system(system) {}
ChartParserUnknown::ChartParserUnknown() {}
ChartParserUnknown::~ChartParserUnknown() {
RemoveAllInColl(m_unksrcs);
@ -122,8 +122,7 @@ void ChartParserUnknown::Process(const Word &sourceWord, const WordsRange &range
}
}
ChartParser::ChartParser(InputType const &source, const TranslationSystem &system, ChartCellCollectionBase &cells) :
m_unknown(system),
ChartParser::ChartParser(InputType const &source, ChartCellCollectionBase &cells) :
m_decodeGraphList(StaticData::Instance().GetDecodeGraphs()),
m_source(source) {
const StaticData &staticData = StaticData::Instance();

View File

@ -33,7 +33,6 @@ namespace Moses
class ChartParserCallback;
class ChartRuleLookupManager;
class InputType;
class TranslationSystem;
class ChartCellCollectionBase;
class Word;
class Phrase;
@ -42,13 +41,12 @@ class DecodeGraph;
class ChartParserUnknown {
public:
ChartParserUnknown(const TranslationSystem &system);
ChartParserUnknown();
~ChartParserUnknown();
void Process(const Word &sourceWord, const WordsRange &range, ChartParserCallback &to);
private:
const TranslationSystem &m_system;
std::vector<Phrase*> m_unksrcs;
std::list<TargetPhraseCollection*> m_cacheTargetPhraseCollection;
StackVec m_emptyStackVec;
@ -56,7 +54,7 @@ class ChartParserUnknown {
class ChartParser {
public:
ChartParser(const InputType &source, const TranslationSystem &system, ChartCellCollectionBase &cells);
ChartParser(const InputType &source, ChartCellCollectionBase &cells);
~ChartParser();
void Create(const WordsRange &range, ChartParserCallback &to);

View File

@ -243,11 +243,11 @@ std::ostream& operator<<(std::ostream& out,const ConfusionNet& cn)
}
TranslationOptionCollection*
ConfusionNet::CreateTranslationOptionCollection(const TranslationSystem* system) const
ConfusionNet::CreateTranslationOptionCollection() const
{
size_t maxNoTransOptPerCoverage = StaticData::Instance().GetMaxNoTransOptPerCoverage();
float translationOptionThreshold = StaticData::Instance().GetTranslationOptionThreshold();
TranslationOptionCollection *rv= new TranslationOptionCollectionConfusionNet(system, *this, maxNoTransOptPerCoverage, translationOptionThreshold);
TranslationOptionCollection *rv= new TranslationOptionCollectionConfusionNet(*this, maxNoTransOptPerCoverage, translationOptionThreshold);
CHECK(rv);
return rv;
}

View File

@ -14,7 +14,6 @@ namespace Moses
class FactorCollection;
class TranslationOptionCollection;
class Sentence;
class TranslationSystem;
/** An input to the decoder where each position can be 1 of a number of words,
* each with an associated probability. Compared with a sentence, where each position is a word
@ -69,7 +68,7 @@ public:
std::string GetStringRep(const std::vector<FactorType> factorsToPrint) const; //TODO not defined
const Word& GetWord(size_t pos) const;
TranslationOptionCollection* CreateTranslationOptionCollection(const TranslationSystem* system) const;
TranslationOptionCollection* CreateTranslationOptionCollection() const;
const NonTerminalSet &GetLabelSet(size_t /*startPos*/, size_t /*endPos*/) const {
CHECK(false);

View File

@ -37,7 +37,6 @@ class TranslationOptionCollection;
class PartialTranslOptColl;
class FactorCollection;
class InputType;
class TranslationSystem;
/** Specification for a decoding step.
* The factored translation model consists of Translation and Generation
@ -96,8 +95,7 @@ public:
/*! Given an input TranslationOption, extend it in some way (put results in outputPartialTranslOptColl) */
virtual void Process(const TranslationSystem* system,
const TranslationOption &inputPartialTranslOpt
virtual void Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc

View File

@ -59,8 +59,7 @@ inline void IncrementIterators(vector< WordListIterator > &wordListIterVector
}
}
void DecodeStepGeneration::Process(const TranslationSystem* system
, const TranslationOption &inputPartialTranslOpt
void DecodeStepGeneration::Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection * /* toc */
@ -70,7 +69,7 @@ void DecodeStepGeneration::Process(const TranslationSystem* system
// word deletion
TranslationOption *newTransOpt = new TranslationOption(inputPartialTranslOpt);
outputPartialTranslOptColl.Add(system, newTransOpt);
outputPartialTranslOptColl.Add(newTransOpt);
return;
}
@ -151,7 +150,7 @@ void DecodeStepGeneration::Process(const TranslationSystem* system
TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase);
assert(newTransOpt);
outputPartialTranslOptColl.Add(system, newTransOpt);
outputPartialTranslOptColl.Add(newTransOpt);
// increment iterators
IncrementIterators(wordListIterVector, wordListVector);

View File

@ -38,8 +38,7 @@ public:
DecodeStepGeneration(const GenerationDictionary* dict, const DecodeStep* prev);
virtual void Process(const TranslationSystem* system
, const TranslationOption &inputPartialTranslOpt
virtual void Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc

View File

@ -34,8 +34,7 @@ DecodeStepTranslation::DecodeStepTranslation(const PhraseDictionary* pdf, const
{
}
void DecodeStepTranslation::Process(const TranslationSystem* system
, const TranslationOption &inputPartialTranslOpt
void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc
@ -44,7 +43,7 @@ void DecodeStepTranslation::Process(const TranslationSystem* system
if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) {
// word deletion
outputPartialTranslOptColl.Add(system, new TranslationOption(inputPartialTranslOpt));
outputPartialTranslOptColl.Add(new TranslationOption(inputPartialTranslOpt));
return;
}
@ -85,7 +84,7 @@ void DecodeStepTranslation::Process(const TranslationSystem* system
TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase);
assert(newTransOpt != NULL);
outputPartialTranslOptColl.Add(system, newTransOpt );
outputPartialTranslOptColl.Add(newTransOpt );
}
} else if (sourceWordsRange.GetNumWordsCovered() == 1) {
@ -95,8 +94,8 @@ void DecodeStepTranslation::Process(const TranslationSystem* system
}
void DecodeStepTranslation::ProcessInitialTranslation(const TranslationSystem* system
, const InputType &source
void DecodeStepTranslation::ProcessInitialTranslation(
const InputType &source
,PartialTranslOptColl &outputPartialTranslOptColl
, size_t startPos, size_t endPos, bool adhereTableLimit) const
{
@ -121,7 +120,7 @@ void DecodeStepTranslation::ProcessInitialTranslation(const TranslationSystem* s
const TargetPhrase &targetPhrase = **iterTargetPhrase;
TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase);
outputPartialTranslOptColl.Add (system, transOpt);
outputPartialTranslOptColl.Add (transOpt);
VERBOSE(3,"\t" << targetPhrase << "\n");
}

View File

@ -39,8 +39,7 @@ public:
DecodeStepTranslation(const PhraseDictionary* phraseFeature, const DecodeStep* prev);
virtual void Process(const TranslationSystem* system
, const TranslationOption &inputPartialTranslOpt
virtual void Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc
@ -50,8 +49,7 @@ public:
/*! initialize list of partial translation options by applying the first translation step
* Ideally, this function should be in DecodeStepTranslation class
*/
void ProcessInitialTranslation(const TranslationSystem* system
, const InputType &source
void ProcessInitialTranslation(const InputType &source
, PartialTranslOptColl &outputPartialTranslOptColl
, size_t startPos, size_t endPos, bool adhereTableLimit) const;

View File

@ -258,8 +258,7 @@ void HypothesisStackCubePruning::SetBitmapAccessor(const WordsBitmap &newBitmap
, *bmContainer
, transOptList
, futureScore,
m_manager.GetSource(),
m_manager.GetTranslationSystem());
m_manager.GetSource());
bmContainer->AddBackwardsEdge(edge);
}

View File

@ -4,7 +4,6 @@
#include "moses/ChartParserCallback.h"
#include "moses/FeatureVector.h"
#include "moses/StaticData.h"
#include "moses/TranslationSystem.h"
#include "moses/Util.h"
#include "lm/model.hh"
@ -172,11 +171,10 @@ struct ChartCellBaseFactory {
} // namespace
Manager::Manager(const InputType &source, const TranslationSystem &system) :
Manager::Manager(const InputType &source) :
source_(source),
system_(system),
cells_(source, ChartCellBaseFactory()),
parser_(source, system, cells_),
parser_(source, cells_),
n_best_(search::NBestConfig(StaticData::Instance().GetNBestSize())) {}
Manager::~Manager() {
@ -279,7 +277,7 @@ void ToPhrase(const search::Applied final, Phrase &out) {
AppendToPhrase(final, out, NoOp());
}
void PhraseAndFeatures(const TranslationSystem &system, const search::Applied final, Phrase &phrase, ScoreComponentCollection &features) {
void PhraseAndFeatures(const search::Applied final, Phrase &phrase, ScoreComponentCollection &features) {
phrase.Clear();
features.ZeroAll();
AppendToPhrase(final, phrase, AccumScore(features));

View File

@ -13,12 +13,11 @@
namespace Moses {
class ScoreComponentCollection;
class InputType;
class TranslationSystem;
namespace Incremental {
class Manager {
public:
Manager(const InputType &source, const TranslationSystem &system);
Manager(const InputType &source);
~Manager();
@ -35,7 +34,6 @@ class Manager {
template <class Model, class Best> search::History PopulateBest(const Model &model, const std::vector<lm::WordIndex> &words, Best &out);
const InputType &source_;
const TranslationSystem &system_;
ChartCellCollectionBase cells_;
ChartParser parser_;
@ -53,7 +51,7 @@ class Manager {
// Just get the phrase.
void ToPhrase(const search::Applied final, Phrase &out);
// Get the phrase and the features.
void PhraseAndFeatures(const TranslationSystem &system, const search::Applied final, Phrase &phrase, ScoreComponentCollection &features);
void PhraseAndFeatures(const search::Applied final, Phrase &phrase, ScoreComponentCollection &features);
} // namespace Incremental
} // namespace Moses

View File

@ -37,7 +37,6 @@ class WordsRange;
class Factor;
class PhraseDictionary;
class TranslationOptionCollection;
class TranslationSystem;
class ChartTranslationOptions;
/** base class for all types of inputs to the decoder,
@ -167,7 +166,7 @@ public:
virtual void Print(std::ostream&) const =0;
//! create trans options specific to this InputType
virtual TranslationOptionCollection* CreateTranslationOptionCollection(const TranslationSystem* system) const=0;
virtual TranslationOptionCollection* CreateTranslationOptionCollection() const=0;
//! return substring. Only valid for Sentence class. TODO - get rid of this fn
virtual Phrase GetSubString(const WordsRange&) const =0;

View File

@ -54,9 +54,8 @@ using namespace std;
namespace Moses
{
Manager::Manager(size_t lineNumber, InputType const& source, SearchAlgorithm searchAlgorithm, const TranslationSystem* system)
:m_system(system)
,m_transOptColl(source.CreateTranslationOptionCollection(system))
Manager::Manager(size_t lineNumber, InputType const& source, SearchAlgorithm searchAlgorithm)
:m_transOptColl(source.CreateTranslationOptionCollection())
,m_search(Search::CreateSearch(*this, source, searchAlgorithm, *m_transOptColl))
,interrupted_flag(0)
,m_hypoId(0)
@ -439,7 +438,7 @@ void Manager::CalcDecoderStatistics() const
}
}
void OutputWordGraph(std::ostream &outputWordGraphStream, const Hypothesis *hypo, size_t &linkId, const TranslationSystem* system)
void OutputWordGraph(std::ostream &outputWordGraphStream, const Hypothesis *hypo, size_t &linkId)
{
const Hypothesis *prevHypo = hypo->GetPrevHypo();
@ -537,7 +536,7 @@ void Manager::GetWordGraph(long translationId, std::ostream &outputWordGraphStre
HypothesisStack::const_iterator iterHypo;
for (iterHypo = stack.begin() ; iterHypo != stack.end() ; ++iterHypo) {
const Hypothesis *hypo = *iterHypo;
OutputWordGraph(outputWordGraphStream, hypo, linkId, m_system);
OutputWordGraph(outputWordGraphStream, hypo, linkId);
if (outputNBest) {
const ArcList *arcList = hypo->GetArcList();
@ -545,7 +544,7 @@ void Manager::GetWordGraph(long translationId, std::ostream &outputWordGraphStre
ArcList::const_iterator iterArcList;
for (iterArcList = arcList->begin() ; iterArcList != arcList->end() ; ++iterArcList) {
const Hypothesis *loserHypo = *iterArcList;
OutputWordGraph(outputWordGraphStream, loserHypo, linkId,m_system);
OutputWordGraph(outputWordGraphStream, loserHypo, linkId);
}
}
} //if (outputNBest)
@ -646,7 +645,6 @@ void Manager::OutputFeatureWeightsForSLF(std::ostream &outputSearchGraphStream)
outputSearchGraphStream.precision(6);
const StaticData& staticData = StaticData::Instance();
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions();
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();
size_t featureIndex = 1;
@ -686,7 +684,6 @@ void Manager::OutputFeatureValuesForSLF(const Hypothesis* hypo, bool zeros, std:
// outputSearchGraphStream << scoreCollection << endl;
const StaticData& staticData = StaticData::Instance();
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const vector<const StatelessFeatureFunction*>& slf =StatelessFeatureFunction::GetStatelessFeatureFunctions();
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();
size_t featureIndex = 1;
@ -721,7 +718,6 @@ void Manager::OutputFeatureValuesForHypergraph(const Hypothesis* hypo, std::ostr
outputSearchGraphStream.precision(6);
const StaticData& staticData = StaticData::Instance();
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
const vector<const StatelessFeatureFunction*>& slf =StatelessFeatureFunction::GetStatelessFeatureFunctions();
const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions();
size_t featureIndex = 1;

View File

@ -96,7 +96,6 @@ class Manager
Manager();
Manager(Manager const&);
void operator=(Manager const&);
const TranslationSystem* m_system;
private:
// Helper functions to output search graph in HTK standard lattice format
@ -132,12 +131,9 @@ protected:
public:
InputType const& m_source; /**< source sentence to be translated */
Manager(size_t lineNumber, InputType const& source, SearchAlgorithm searchAlgorithm, const TranslationSystem* system);
Manager(size_t lineNumber, InputType const& source, SearchAlgorithm searchAlgorithm);
~Manager();
const TranslationOptionCollection* getSntTranslationOptions();
const TranslationSystem* GetTranslationSystem() {
return m_system;
}
void ProcessSentence();
const Hypothesis *GetBestHypothesis() const;

View File

@ -40,7 +40,7 @@ MockHypothesisGuard::MockHypothesisGuard(
m_wp("WordPenalty"),
m_uwp("UnknownWordPenalty"),
m_dist("Distortion"),
m_manager(0,m_sentence,Normal,&m_system)
m_manager(0,m_sentence,Normal)
{
BOOST_CHECK_EQUAL(alignments.size(), targetSegments.size());

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "DummyScoreProducers.h"
#include "Hypothesis.h"
#include "Manager.h"
#include "TranslationSystem.h"
namespace MosesTest {
@ -57,7 +56,6 @@ class MockHypothesisGuard {
Moses::WordPenaltyProducer m_wp;
Moses::UnknownWordPenaltyProducer m_uwp;
Moses::DistortionScoreProducer m_dist;
Moses::TranslationSystem m_system;
Moses::Manager m_manager;
Moses::Hypothesis* m_hypothesis;
std::vector<Moses::TargetPhrase> m_targetPhrases;

View File

@ -141,7 +141,6 @@ protected:
}
//TODO: Multiple models broken here
const TranslationSystem& system = StaticData::Instance().GetTranslationSystem(TranslationSystem::DEFAULT);
std::vector<float> weights = StaticData::Instance().GetWeights(m_obj);
float weightWP = StaticData::Instance().GetWeightWordPenalty();
@ -367,7 +366,6 @@ protected:
for(Position i=0 ; i < srcSize ; ++i)
stack.push_back(State(i, i, m_dict->GetRoot(), std::vector<float>(m_numInputScores,0.0)));
const TranslationSystem& system = StaticData::Instance().GetTranslationSystem(TranslationSystem::DEFAULT);
std::vector<float> weightT = StaticData::Instance().GetWeights(m_obj);
float weightWP = StaticData::Instance().GetWeightWordPenalty();

View File

@ -38,7 +38,7 @@ PartialTranslOptColl::PartialTranslOptColl()
/** add a partial translation option to the collection (without pruning) */
void PartialTranslOptColl::AddNoPrune(const TranslationSystem* system, TranslationOption *partialTranslOpt)
void PartialTranslOptColl::AddNoPrune(TranslationOption *partialTranslOpt)
{
if (partialTranslOpt->GetFutureScore() >= m_worstScore) {
m_list.push_back(partialTranslOpt);
@ -53,10 +53,10 @@ void PartialTranslOptColl::AddNoPrune(const TranslationSystem* system, Translati
/** add a partial translation option to the collection, prune if necessary.
* This is done similar to the Prune() in TranslationOptionCollection */
void PartialTranslOptColl::Add(const TranslationSystem* system, TranslationOption *partialTranslOpt)
void PartialTranslOptColl::Add(TranslationOption *partialTranslOpt)
{
// add
AddNoPrune(system,partialTranslOpt );
AddNoPrune(partialTranslOpt );
// done if not too large (lazy pruning, only if twice as large as max)
if ( m_list.size() > 2 * m_maxSize ) {

View File

@ -60,8 +60,8 @@ public:
RemoveAllInColl( m_list );
}
void AddNoPrune(const TranslationSystem* system, TranslationOption *partialTranslOpt);
void Add(const TranslationSystem* system, TranslationOption *partialTranslOpt);
void AddNoPrune(TranslationOption *partialTranslOpt);
void Add(TranslationOption *partialTranslOpt);
void Prune();
/** returns list of translation options */

View File

@ -189,11 +189,11 @@ void Sentence::InitStartEndWord()
}
TranslationOptionCollection*
Sentence::CreateTranslationOptionCollection(const TranslationSystem* system) const
Sentence::CreateTranslationOptionCollection() const
{
size_t maxNoTransOptPerCoverage = StaticData::Instance().GetMaxNoTransOptPerCoverage();
float transOptThreshold = StaticData::Instance().GetTranslationOptionThreshold();
TranslationOptionCollection *rv= new TranslationOptionCollectionText(system, *this, maxNoTransOptPerCoverage, transOptThreshold);
TranslationOptionCollection *rv= new TranslationOptionCollectionText(*this, maxNoTransOptPerCoverage, transOptThreshold);
CHECK(rv);
return rv;
}

View File

@ -90,7 +90,7 @@ public:
int Read(std::istream& in,const std::vector<FactorType>& factorOrder);
void Print(std::ostream& out) const;
TranslationOptionCollection* CreateTranslationOptionCollection(const TranslationSystem* system) const;
TranslationOptionCollection* CreateTranslationOptionCollection() const;
void CreateFromString(const std::vector<FactorType> &factorOrder
, const std::string &phraseString

View File

@ -1018,7 +1018,6 @@ void StaticData::ReLoadParameter()
}
//loop over all ScoreProducer to update weights
const TranslationSystem &transSystem = GetTranslationSystem(TranslationSystem::DEFAULT);
std::vector<const ScoreProducer*>::const_iterator iterSP;
for (iterSP = transSystem.GetFeatureFunctions().begin() ; iterSP != transSystem.GetFeatureFunctions().end() ; ++iterSP) {
@ -1071,7 +1070,6 @@ void StaticData::ReLoadBleuScoreFeatureParameter(float weight)
assert(false);
/*
//loop over ScoreProducers to update weights of BleuScoreFeature
const TranslationSystem &transSystem = GetTranslationSystem(TranslationSystem::DEFAULT);
std::vector<const ScoreProducer*>::const_iterator iterSP;
for (iterSP = transSystem.GetFeatureFunctions().begin() ; iterSP != transSystem.GetFeatureFunctions().end() ; ++iterSP) {

View File

@ -45,7 +45,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "SentenceStats.h"
#include "DecodeGraph.h"
#include "TranslationOptionList.h"
#include "TranslationSystem.h"
#include "ScoreComponentCollection.h"
#include "moses/TranslationModel/PhraseDictionary.h"
@ -59,7 +58,6 @@ class DecodeStep;
class UnknownWordPenaltyProducer;
class MetaScoreProducer;
class MetaFeatureProducer;
class TranslationSystem;
typedef std::pair<std::string, float> UnknownLHSEntry;
typedef std::vector<UnknownLHSEntry> UnknownLHSList;
@ -86,7 +84,6 @@ protected:
std::vector<size_t> m_decodeGraphBackoff;
// Initial = 0 = can be used when creating poss trans
// Other = 1 = used to calculate LM score once all steps have been processed
TranslationSystem m_translationSystem;
float
m_beamWidth,
m_earlyDiscardingThreshold,
@ -346,9 +343,6 @@ public:
return m_translationOptionThreshold;
}
const TranslationSystem& GetTranslationSystem(std::string id) const {
return m_translationSystem;
}
size_t GetVerboseLevel() const {
return m_verboseLevel;
}

View File

@ -39,7 +39,6 @@ namespace Moses
class LMList;
class FeatureFunction;
class TranslationSystem;
class WordPenaltyProducer;
/** represents an entry on the target side of a phrase table (scores, translation, alignment)

View File

@ -46,7 +46,6 @@ class StaticData;
class InputType;
class WordsRange;
class ChartCellCollectionBase;
class TranslationSystem;
class ChartRuleLookupManager;
/**

View File

@ -47,10 +47,9 @@ bool CompareTranslationOption(const TranslationOption *a, const TranslationOptio
/** constructor; since translation options are indexed by coverage span, the corresponding data structure is initialized here
* This fn should be called by inherited classes
*/
TranslationOptionCollection::TranslationOptionCollection(const TranslationSystem* system,
TranslationOptionCollection::TranslationOptionCollection(
InputType const& src, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
: m_system(system),
m_source(src)
: m_source(src)
,m_futureScore(src.GetSize())
,m_maxNoTransOptPerCoverage(maxNoTransOptPerCoverage)
,m_translationOptionThreshold(translationOptionThreshold)
@ -485,7 +484,7 @@ void TranslationOptionCollection::CreateTranslationOptionsForRange(
const DecodeStep &decodeStep = **iterStep;
static_cast<const DecodeStepTranslation&>(decodeStep).ProcessInitialTranslation
(m_system, m_source, *oldPtoc
(m_source, *oldPtoc
, startPos, endPos, adhereTableLimit );
// do rest of decode steps
@ -500,7 +499,7 @@ void TranslationOptionCollection::CreateTranslationOptionsForRange(
for (iterPartialTranslOpt = partTransOptList.begin() ; iterPartialTranslOpt != partTransOptList.end() ; ++iterPartialTranslOpt) {
TranslationOption &inputPartialTranslOpt = **iterPartialTranslOpt;
decodeStep.Process(m_system, inputPartialTranslOpt
decodeStep.Process(inputPartialTranslOpt
, decodeStep
, *newPtoc
, this

View File

@ -62,7 +62,6 @@ class TranslationOptionCollection
friend std::ostream& operator<<(std::ostream& out, const TranslationOptionCollection& coll);
TranslationOptionCollection(const TranslationOptionCollection&); /*< no copy constructor */
protected:
const TranslationSystem* m_system;
std::vector< std::vector< TranslationOptionList > > m_collection; /*< contains translation options */
InputType const &m_source; /*< reference to the input */
SquareMatrix m_futureScore; /*< matrix of future costs for contiguous parts (span) of the input */
@ -70,7 +69,7 @@ protected:
const float m_translationOptionThreshold; /*< threshold for translation options with regard to best option for input span */
std::vector<Phrase*> m_unksrcs;
TranslationOptionCollection(const TranslationSystem* system, InputType const& src, size_t maxNoTransOptPerCoverage,
TranslationOptionCollection(InputType const& src, size_t maxNoTransOptPerCoverage,
float translationOptionThreshold);
void CalcFutureScore();

View File

@ -9,10 +9,10 @@ namespace Moses
{
/** constructor; just initialize the base class */
TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet(const TranslationSystem* system,
TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet(
const ConfusionNet &input
, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
: TranslationOptionCollection(system, input, maxNoTransOptPerCoverage, translationOptionThreshold) {}
: TranslationOptionCollection(input, maxNoTransOptPerCoverage, translationOptionThreshold) {}
/* forcibly create translation option for a particular source word.
* call the base class' ProcessOneUnknownWord() for each possible word in the confusion network

View File

@ -8,7 +8,6 @@ namespace Moses
{
class ConfusionNet;
class TranslationSystem;
/** Holds all translation options, for all spans, of a particular confusion network input
* Inherited from TranslationOptionCollection.
@ -16,7 +15,7 @@ class TranslationSystem;
class TranslationOptionCollectionConfusionNet : public TranslationOptionCollection
{
public:
TranslationOptionCollectionConfusionNet(const TranslationSystem* system, const ConfusionNet &source, size_t maxNoTransOptPerCoverage, float translationOptionThreshold);
TranslationOptionCollectionConfusionNet(const ConfusionNet &source, size_t maxNoTransOptPerCoverage, float translationOptionThreshold);
void ProcessUnknownWord(size_t sourcePos);

View File

@ -30,8 +30,8 @@ using namespace std;
namespace Moses
{
/** constructor; just initialize the base class */
TranslationOptionCollectionText::TranslationOptionCollectionText(const TranslationSystem* system, Sentence const &inputSentence, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
: TranslationOptionCollection(system, inputSentence, maxNoTransOptPerCoverage, translationOptionThreshold) {}
TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const &inputSentence, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
: TranslationOptionCollection(inputSentence, maxNoTransOptPerCoverage, translationOptionThreshold) {}
/* forcibly create translation option for a particular source word.
* For text, this function is easy, just call the base class' ProcessOneUnknownWord()

View File

@ -38,7 +38,7 @@ class TranslationOptionCollectionText : public TranslationOptionCollection
public:
void ProcessUnknownWord(size_t sourcePos);
TranslationOptionCollectionText(const TranslationSystem* system, Sentence const& inputSentence, size_t maxNoTransOptPerCoverage, float translationOptionThreshold);
TranslationOptionCollectionText(Sentence const& inputSentence, size_t maxNoTransOptPerCoverage, float translationOptionThreshold);
bool HasXmlOptionsOverlappingRange(size_t startPosition, size_t endPosition) const;

View File

@ -1,36 +0,0 @@
// $Id: $
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2010 University of Edinburgh
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.
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.
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
***********************************************************************/
#include <string>
#include "TranslationSystem.h"
using namespace std;
namespace Moses {
const string TranslationSystem::DEFAULT = "default";
TranslationSystem::TranslationSystem()
{
}
};

View File

@ -1,52 +0,0 @@
// $Id: $
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2010 University of Edinburgh
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.
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.
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
***********************************************************************/
#ifndef moses_TranslationSystem_h
#define moses_TranslationSystem_h
namespace Moses
{
/**
* Enables the configuration of multiple translation systems.
**/
class TranslationSystem {
public:
/** Creates a system with the given id */
TranslationSystem();
static const std::string DEFAULT;
private:
};
}
#endif