mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-26 11:28:48 +03:00
Fix a few warnings.
This commit is contained in:
parent
60a96dfc45
commit
e5ebf30664
@ -14,7 +14,7 @@ class PhraseProperty
|
||||
|
||||
public:
|
||||
PhraseProperty() : m_value(NULL) {};
|
||||
~PhraseProperty() { if ( m_value != NULL ) delete m_value; };
|
||||
virtual ~PhraseProperty() { if ( m_value != NULL ) delete m_value; };
|
||||
|
||||
virtual void ProcessValue(const std::string &value) { m_value = new std::string(value); };
|
||||
|
||||
|
@ -741,7 +741,6 @@ void StaticData::LoadDecodeGraphsNew(const std::vector<std::string> &mappingVect
|
||||
for(size_t i=0; i<mappingVector.size(); i++) {
|
||||
vector<string> token = Tokenize(mappingVector[i]);
|
||||
size_t decodeGraphInd;
|
||||
size_t index;
|
||||
|
||||
decodeGraphInd = Scan<size_t>(token[0]);
|
||||
//the vectorList index can only increment by one
|
||||
|
@ -106,14 +106,10 @@ RuleTrieCYKPlus::Node &RuleTrieCYKPlus::GetOrCreateNode(
|
||||
const Word& word = source.GetWord(pos);
|
||||
|
||||
if (word.IsNonTerminal()) {
|
||||
// indexed by source label 1st
|
||||
const Word &sourceNonTerm = word;
|
||||
|
||||
UTIL_THROW_IF2(iterAlign == alignmentInfo.end(),
|
||||
"No alignment for non-term at position " << pos);
|
||||
UTIL_THROW_IF2(iterAlign->first != pos,
|
||||
"Alignment info incorrect at position " << pos);
|
||||
|
||||
std::size_t targetNonTermInd = iterAlign->second;
|
||||
++iterAlign;
|
||||
const Word &targetNonTerm = target.GetWord(targetNonTermInd);
|
||||
@ -122,13 +118,9 @@ RuleTrieCYKPlus::Node &RuleTrieCYKPlus::GetOrCreateNode(
|
||||
currNode = currNode->GetOrCreateChild(word);
|
||||
}
|
||||
|
||||
UTIL_THROW_IF2(currNode == NULL,
|
||||
"Node not found at position " << pos);
|
||||
UTIL_THROW_IF2(currNode == NULL, "Node not found at position " << pos);
|
||||
}
|
||||
|
||||
// finally, the source LHS
|
||||
//currNode = currNode->GetOrCreateChild(sourceLHS);
|
||||
|
||||
return *currNode;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ bool RuleTrieLoader::Load(const std::vector<FactorType> &input,
|
||||
PrintUserTime(std::string("Start loading text phrase table. Moses format"));
|
||||
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
const std::string &factorDelimiter = staticData.GetFactorDelimiter();
|
||||
|
||||
std::size_t count = 0;
|
||||
|
||||
@ -75,10 +74,6 @@ bool RuleTrieLoader::Load(const std::vector<FactorType> &input,
|
||||
alignString = temp;
|
||||
}
|
||||
|
||||
if (++pipes) {
|
||||
StringPiece str(*pipes); //counts
|
||||
}
|
||||
|
||||
bool isLHSEmpty = (sourcePhraseString.find_first_not_of(" \t", 0) == std::string::npos);
|
||||
if (isLHSEmpty && !staticData.IsWordDeletionEnabled()) {
|
||||
TRACE_ERR( ff.GetFilePath() << ":" << count << ": pt entry contains empty target, skipping\n");
|
||||
@ -106,18 +101,16 @@ bool RuleTrieLoader::Load(const std::vector<FactorType> &input,
|
||||
|
||||
// create target phrase obj
|
||||
TargetPhrase *targetPhrase = new TargetPhrase(&ff);
|
||||
// targetPhrase->CreateFromString(Output, output, targetPhraseString, factorDelimiter, &targetLHS);
|
||||
targetPhrase->CreateFromString(Output, output, targetPhraseString, &targetLHS);
|
||||
// source
|
||||
Phrase sourcePhrase;
|
||||
// sourcePhrase.CreateFromString(Input, input, sourcePhraseString, factorDelimiter, &sourceLHS);
|
||||
sourcePhrase.CreateFromString(Input, input, sourcePhraseString, &sourceLHS);
|
||||
|
||||
// rest of target phrase
|
||||
targetPhrase->SetAlignmentInfo(alignString);
|
||||
targetPhrase->SetTargetLHS(targetLHS);
|
||||
|
||||
//targetPhrase->SetDebugOutput(string("New Format pt ") + line);
|
||||
++pipes; // skip over counts field.
|
||||
|
||||
if (++pipes) {
|
||||
StringPiece sparseString(*pipes);
|
||||
|
@ -190,10 +190,6 @@ bool RuleTableLoaderStandard::Load(FormatType format
|
||||
alignString = temp;
|
||||
}
|
||||
|
||||
if (++pipes) {
|
||||
StringPiece str(*pipes); //counts
|
||||
}
|
||||
|
||||
bool isLHSEmpty = (sourcePhraseString.find_first_not_of(" \t", 0) == string::npos);
|
||||
if (isLHSEmpty && !staticData.IsWordDeletionEnabled()) {
|
||||
TRACE_ERR( ruleTable.GetFilePath() << ":" << count << ": pt entry contains empty target, skipping\n");
|
||||
@ -230,7 +226,7 @@ bool RuleTableLoaderStandard::Load(FormatType format
|
||||
targetPhrase->SetAlignmentInfo(alignString);
|
||||
targetPhrase->SetTargetLHS(targetLHS);
|
||||
|
||||
//targetPhrase->SetDebugOutput(string("New Format pt ") + line);
|
||||
++pipes; // skip over counts field
|
||||
|
||||
if (++pipes) {
|
||||
StringPiece sparseString(*pipes);
|
||||
|
@ -80,8 +80,6 @@ const OnDiskPt::OnDiskWrapper &PhraseDictionaryOnDisk::GetImplementation() const
|
||||
|
||||
void PhraseDictionaryOnDisk::InitializeForInput(InputType const& source)
|
||||
{
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
|
||||
ReduceCache();
|
||||
|
||||
OnDiskPt::OnDiskWrapper *obj = new OnDiskPt::OnDiskWrapper();
|
||||
|
@ -57,38 +57,30 @@ void TranslationTask::Run()
|
||||
// which manager
|
||||
BaseManager *manager;
|
||||
|
||||
switch (staticData.IsChart())
|
||||
{
|
||||
case false:
|
||||
// phrase-based
|
||||
manager = new Manager(*m_source);
|
||||
break;
|
||||
case true:
|
||||
if (staticData.UseS2TDecoder()) {
|
||||
// various syntax models by Phul Williams
|
||||
S2TParsingAlgorithm algorithm = staticData.GetS2TParsingAlgorithm();
|
||||
if (algorithm == RecursiveCYKPlus) {
|
||||
typedef Syntax::S2T::EagerParserCallback Callback;
|
||||
typedef Syntax::S2T::RecursiveCYKPlusParser<Callback> Parser;
|
||||
manager = new Syntax::S2T::Manager<Parser>(*m_source);
|
||||
} else if (algorithm == Scope3) {
|
||||
typedef Syntax::S2T::StandardParserCallback Callback;
|
||||
typedef Syntax::S2T::Scope3Parser<Callback> Parser;
|
||||
manager = new Syntax::S2T::Manager<Parser>(*m_source);
|
||||
} else {
|
||||
UTIL_THROW2("ERROR: unhandled S2T parsing algorithm");
|
||||
}
|
||||
}
|
||||
else if (staticData.GetSearchAlgorithm() == ChartIncremental) {
|
||||
// Ken's incremental decoding
|
||||
manager = new Incremental::Manager(*m_source);
|
||||
}
|
||||
else {
|
||||
// original SCFG manager
|
||||
manager = new ChartManager(*m_source);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!staticData.IsChart()) {
|
||||
// phrase-based
|
||||
manager = new Manager(*m_source);
|
||||
} else if (staticData.UseS2TDecoder()) {
|
||||
// new-style string-to-tree decoding (ask Phil Williams)
|
||||
S2TParsingAlgorithm algorithm = staticData.GetS2TParsingAlgorithm();
|
||||
if (algorithm == RecursiveCYKPlus) {
|
||||
typedef Syntax::S2T::EagerParserCallback Callback;
|
||||
typedef Syntax::S2T::RecursiveCYKPlusParser<Callback> Parser;
|
||||
manager = new Syntax::S2T::Manager<Parser>(*m_source);
|
||||
} else if (algorithm == Scope3) {
|
||||
typedef Syntax::S2T::StandardParserCallback Callback;
|
||||
typedef Syntax::S2T::Scope3Parser<Callback> Parser;
|
||||
manager = new Syntax::S2T::Manager<Parser>(*m_source);
|
||||
} else {
|
||||
UTIL_THROW2("ERROR: unhandled S2T parsing algorithm");
|
||||
}
|
||||
} else if (staticData.GetSearchAlgorithm() == ChartIncremental) {
|
||||
// Ken's incremental decoding
|
||||
manager = new Incremental::Manager(*m_source);
|
||||
} else {
|
||||
// original SCFG manager
|
||||
manager = new ChartManager(*m_source);
|
||||
}
|
||||
|
||||
VERBOSE(1, "Line " << translationId << ": Initialize search took " << initTime << " seconds total" << endl);
|
||||
manager->Decode();
|
||||
|
Loading…
Reference in New Issue
Block a user