Merge branch 'master' of github.com:moses-smt/mosesdecoder

This commit is contained in:
Kenneth Heafield 2011-10-24 17:55:18 +01:00
commit c74d772bd9
9 changed files with 33 additions and 17 deletions

View File

@ -426,8 +426,7 @@
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
/opt/local/include/, /opt/local/include/,
/Users/hieuhoang/workspace/sourceforge/trunk/kenlm, ../kenlm,
/usr/local/include,
../srilm/include, ../srilm/include,
); );
INSTALL_PATH = /usr/local/lib; INSTALL_PATH = /usr/local/lib;
@ -447,8 +446,7 @@
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
/opt/local/include/, /opt/local/include/,
/Users/hieuhoang/workspace/sourceforge/trunk/kenlm, ../kenlm,
/usr/local/include,
../srilm/include, ../srilm/include,
); );
INSTALL_PATH = /usr/local/lib; INSTALL_PATH = /usr/local/lib;

View File

@ -62,6 +62,7 @@
1E2E163F132A892800ED4085 /* ThreadPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E2E1638132A892800ED4085 /* ThreadPool.h */; }; 1E2E163F132A892800ED4085 /* ThreadPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E2E1638132A892800ED4085 /* ThreadPool.h */; };
1E46B5A613BA5C7F0084F898 /* RuleCubeItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E46B5A413BA5C7F0084F898 /* RuleCubeItem.cpp */; }; 1E46B5A613BA5C7F0084F898 /* RuleCubeItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E46B5A413BA5C7F0084F898 /* RuleCubeItem.cpp */; };
1E46B5A713BA5C7F0084F898 /* RuleCubeItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E46B5A513BA5C7F0084F898 /* RuleCubeItem.h */; }; 1E46B5A713BA5C7F0084F898 /* RuleCubeItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E46B5A513BA5C7F0084F898 /* RuleCubeItem.h */; };
1E474E12145575CA00178AD5 /* RuleTableLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E474E11145575CA00178AD5 /* RuleTableLoader.h */; };
1E528B9D13A12B2D00E9A67E /* params.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E528B9B13A12B2D00E9A67E /* params.cpp */; }; 1E528B9D13A12B2D00E9A67E /* params.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E528B9B13A12B2D00E9A67E /* params.cpp */; };
1E528B9E13A12B2D00E9A67E /* SyntacticLanguageModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E528B9C13A12B2D00E9A67E /* SyntacticLanguageModel.cpp */; }; 1E528B9E13A12B2D00E9A67E /* SyntacticLanguageModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E528B9C13A12B2D00E9A67E /* SyntacticLanguageModel.cpp */; };
1EA6AB4A13BCC838004465AF /* ChartRuleLookupManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EA6AB4813BCC838004465AF /* ChartRuleLookupManager.cpp */; }; 1EA6AB4A13BCC838004465AF /* ChartRuleLookupManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EA6AB4813BCC838004465AF /* ChartRuleLookupManager.cpp */; };
@ -323,6 +324,7 @@
1E2E1638132A892800ED4085 /* ThreadPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPool.h; path = src/ThreadPool.h; sourceTree = "<group>"; }; 1E2E1638132A892800ED4085 /* ThreadPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPool.h; path = src/ThreadPool.h; sourceTree = "<group>"; };
1E46B5A413BA5C7F0084F898 /* RuleCubeItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RuleCubeItem.cpp; path = src/RuleCubeItem.cpp; sourceTree = "<group>"; }; 1E46B5A413BA5C7F0084F898 /* RuleCubeItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RuleCubeItem.cpp; path = src/RuleCubeItem.cpp; sourceTree = "<group>"; };
1E46B5A513BA5C7F0084F898 /* RuleCubeItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuleCubeItem.h; path = src/RuleCubeItem.h; sourceTree = "<group>"; }; 1E46B5A513BA5C7F0084F898 /* RuleCubeItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuleCubeItem.h; path = src/RuleCubeItem.h; sourceTree = "<group>"; };
1E474E11145575CA00178AD5 /* RuleTableLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuleTableLoader.h; path = src/RuleTableLoader.h; sourceTree = "<group>"; };
1E528B9B13A12B2D00E9A67E /* params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = params.cpp; path = src/DynSAInclude/params.cpp; sourceTree = "<group>"; }; 1E528B9B13A12B2D00E9A67E /* params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = params.cpp; path = src/DynSAInclude/params.cpp; sourceTree = "<group>"; };
1E528B9C13A12B2D00E9A67E /* SyntacticLanguageModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyntacticLanguageModel.cpp; path = src/SyntacticLanguageModel.cpp; sourceTree = "<group>"; }; 1E528B9C13A12B2D00E9A67E /* SyntacticLanguageModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyntacticLanguageModel.cpp; path = src/SyntacticLanguageModel.cpp; sourceTree = "<group>"; };
1EA6AB4813BCC838004465AF /* ChartRuleLookupManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartRuleLookupManager.cpp; path = src/ChartRuleLookupManager.cpp; sourceTree = "<group>"; }; 1EA6AB4813BCC838004465AF /* ChartRuleLookupManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartRuleLookupManager.cpp; path = src/ChartRuleLookupManager.cpp; sourceTree = "<group>"; };
@ -555,6 +557,7 @@
08FB7795FE84155DC02AAC07 /* Source */ = { 08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
1E474E11145575CA00178AD5 /* RuleTableLoader.h */,
1E16D086144DAA3F00B60B4F /* LM */, 1E16D086144DAA3F00B60B4F /* LM */,
1ED0FD4C124BB9380029177F /* AlignmentInfo.cpp */, 1ED0FD4C124BB9380029177F /* AlignmentInfo.cpp */,
1ED0FD4D124BB9380029177F /* AlignmentInfo.h */, 1ED0FD4D124BB9380029177F /* AlignmentInfo.h */,
@ -996,6 +999,7 @@
1E16D0B6144DAA6C00B60B4F /* ParallelBackoff.h in Headers */, 1E16D0B6144DAA6C00B60B4F /* ParallelBackoff.h in Headers */,
1E16D0BC144DAA6C00B60B4F /* SingleFactor.h in Headers */, 1E16D0BC144DAA6C00B60B4F /* SingleFactor.h in Headers */,
1E16D0BE144DAA6C00B60B4F /* SRI.h in Headers */, 1E16D0BE144DAA6C00B60B4F /* SRI.h in Headers */,
1E474E12145575CA00178AD5 /* RuleTableLoader.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -77,7 +77,7 @@ void ChartRuleLookupManagerMemory::GetChartRuleCollection(
// get list of all rules that apply to spans at same starting position // get list of all rules that apply to spans at same starting position
DottedRuleColl &dottedRuleCol = *m_dottedRuleColls[range.GetStartPos()]; DottedRuleColl &dottedRuleCol = *m_dottedRuleColls[range.GetStartPos()];
const DottedRuleList &expandableDottedRuleList = dottedRuleCol.GetExpandableDottedRuleList(); const DottedRuleList &expandableDottedRuleList = dottedRuleCol.GetExpandableDottedRuleList();
const ChartCellLabel &sourceWordLabel = GetCellCollection().Get(WordsRange(absEndPos, absEndPos)).GetSourceWordLabel(); const ChartCellLabel &sourceWordLabel = GetCellCollection().Get(WordsRange(absEndPos, absEndPos)).GetSourceWordLabel();
// loop through the rules // loop through the rules

View File

@ -64,7 +64,7 @@ void PhraseDictionaryNodeSCFG::Sort(size_t tableLimit)
PhraseDictionaryNodeSCFG *PhraseDictionaryNodeSCFG::GetOrCreateChild(const Word &sourceTerm) PhraseDictionaryNodeSCFG *PhraseDictionaryNodeSCFG::GetOrCreateChild(const Word &sourceTerm)
{ {
assert(!sourceTerm.IsNonTerminal()); //assert(!sourceTerm.IsNonTerminal());
std::pair <TerminalMap::iterator,bool> insResult; std::pair <TerminalMap::iterator,bool> insResult;
insResult = m_sourceTermMap.insert( std::make_pair(sourceTerm, PhraseDictionaryNodeSCFG()) ); insResult = m_sourceTermMap.insert( std::make_pair(sourceTerm, PhraseDictionaryNodeSCFG()) );

View File

@ -63,13 +63,18 @@ bool PhraseDictionarySCFG::Load(const std::vector<FactorType> &input
return ret; return ret;
} }
TargetPhraseCollection &PhraseDictionarySCFG::GetOrCreateTargetPhraseCollection(const Phrase &source, const TargetPhrase &target) TargetPhraseCollection &PhraseDictionarySCFG::GetOrCreateTargetPhraseCollection(
const Phrase &source
, const TargetPhrase &target
, const Word &sourceLHS)
{ {
PhraseDictionaryNodeSCFG &currNode = GetOrCreateNode(source, target); PhraseDictionaryNodeSCFG &currNode = GetOrCreateNode(source, target, sourceLHS);
return currNode.GetOrCreateTargetPhraseCollection(); return currNode.GetOrCreateTargetPhraseCollection();
} }
PhraseDictionaryNodeSCFG &PhraseDictionarySCFG::GetOrCreateNode(const Phrase &source, const TargetPhrase &target) PhraseDictionaryNodeSCFG &PhraseDictionarySCFG::GetOrCreateNode(const Phrase &source
, const TargetPhrase &target
, const Word &sourceLHS)
{ {
const size_t size = source.GetSize(); const size_t size = source.GetSize();
@ -97,7 +102,12 @@ PhraseDictionaryNodeSCFG &PhraseDictionarySCFG::GetOrCreateNode(const Phrase &so
assert(currNode != NULL); assert(currNode != NULL);
} }
// finally, the source LHS
//currNode = currNode->GetOrCreateChild(sourceLHS);
//assert(currNode != NULL);
return *currNode; return *currNode;
} }

View File

@ -78,10 +78,11 @@ class PhraseDictionarySCFG : public PhraseDictionary
private: private:
TargetPhraseCollection &GetOrCreateTargetPhraseCollection( TargetPhraseCollection &GetOrCreateTargetPhraseCollection(
const Phrase &source, const TargetPhrase &target); const Phrase &source, const TargetPhrase &target, const Word &sourceLHS);
PhraseDictionaryNodeSCFG &GetOrCreateNode(const Phrase &source, PhraseDictionaryNodeSCFG &GetOrCreateNode(const Phrase &source
const TargetPhrase &target); , const TargetPhrase &target
, const Word &sourceLHS);
void SortAndPrune(); void SortAndPrune();

View File

@ -56,9 +56,11 @@ class RuleTableLoader
// Provide access to PhraseDictionarySCFG's private // Provide access to PhraseDictionarySCFG's private
// GetOrCreateTargetPhraseCollection function. // GetOrCreateTargetPhraseCollection function.
TargetPhraseCollection &GetOrCreateTargetPhraseCollection( TargetPhraseCollection &GetOrCreateTargetPhraseCollection(
PhraseDictionarySCFG &ruleTable, const Phrase &source, PhraseDictionarySCFG &ruleTable
const TargetPhrase &target) { , const Phrase &source
return ruleTable.GetOrCreateTargetPhraseCollection(source, target); , const TargetPhrase &target
, const Word &sourceLHS) {
return ruleTable.GetOrCreateTargetPhraseCollection(source, target, sourceLHS);
} }
}; };

View File

@ -202,6 +202,7 @@ bool RuleTableLoaderCompact::LoadRuleSection(
const Phrase &sourcePhrase = sourcePhrases[sourcePhraseId]; const Phrase &sourcePhrase = sourcePhrases[sourcePhraseId];
const Phrase &targetPhrasePhrase = targetPhrases[targetPhraseId]; const Phrase &targetPhrasePhrase = targetPhrases[targetPhraseId];
const Word &targetLhs = vocab[targetLhsIds[targetPhraseId]]; const Word &targetLhs = vocab[targetLhsIds[targetPhraseId]];
Word sourceLHS("X"); // TODO not implemented for compact
const AlignmentInfo *alignmentInfo = alignmentSets[alignmentSetId]; const AlignmentInfo *alignmentInfo = alignmentSets[alignmentSetId];
// Then there should be one score for each score component. // Then there should be one score for each score component.
@ -229,7 +230,7 @@ bool RuleTableLoaderCompact::LoadRuleSection(
// Insert rule into table. // Insert rule into table.
TargetPhraseCollection &coll = GetOrCreateTargetPhraseCollection( TargetPhraseCollection &coll = GetOrCreateTargetPhraseCollection(
ruleTable, sourcePhrase, *targetPhrase); ruleTable, sourcePhrase, *targetPhrase, sourceLHS);
coll.Add(targetPhrase); coll.Add(targetPhrase);
} }

View File

@ -118,7 +118,7 @@ bool RuleTableLoaderStandard::Load(const std::vector<FactorType> &input
targetPhrase->SetScoreChart(ruleTable.GetFeature(), scoreVector, weight, languageModels,wpProducer); targetPhrase->SetScoreChart(ruleTable.GetFeature(), scoreVector, weight, languageModels,wpProducer);
TargetPhraseCollection &phraseColl = GetOrCreateTargetPhraseCollection(ruleTable, sourcePhrase, *targetPhrase); TargetPhraseCollection &phraseColl = GetOrCreateTargetPhraseCollection(ruleTable, sourcePhrase, *targetPhrase, sourceLHS);
phraseColl.Add(targetPhrase); phraseColl.Add(targetPhrase);
count++; count++;