mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
probing pt source vocab
This commit is contained in:
parent
49d3564a1b
commit
f4befcf125
@ -11,12 +11,12 @@
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
@ -79,8 +79,11 @@
|
||||
</folderInfo>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.511477442" name="Rand.h" rcbsApplicability="disable" resourcePath="LM/Rand.h" toolsToInvoke=""/>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.790052015" name="IRST.h" rcbsApplicability="disable" resourcePath="LM/IRST.h" toolsToInvoke=""/>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.1228569547" name="FuzzyMatchWrapper.cpp" rcbsApplicability="disable" resourcePath="TranslationModel/fuzzy-match/FuzzyMatchWrapper.cpp" toolsToInvoke="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1774992327.200046295">
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1774992327.200046295" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1774992327"/>
|
||||
</fileInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="TranslationModel/CompactPT|LM/NeuralLMWrapper.cpp|FF/PhraseLengthFeatureTest.cpp|PhraseLengthFeatureTest.cpp|LM/BackwardTest.cpp|LM/BackwardLMState.h|LM/BackwardLMState.cpp|LM/Backward.h|LM/Backward.cpp|FeatureVectorTest.cpp|LM/ParallelBackoff.h|LM/ParallelBackoff.cpp|src/SyntacticLanguageModelState.h|src/SyntacticLanguageModelFiles.h|src/SyntacticLanguageModel.h|src/SyntacticLanguageModel.cpp|src/LM/SRI.h|src/LM/SRI.cpp|src/LM/Rand.h|src/LM/Rand.cpp|src/LM/LDHT.h|src/LM/LDHT.cpp|SyntacticLanguageModelState.h|SyntacticLanguageModelFiles.h|SyntacticLanguageModel.h|SyntacticLanguageModel.cpp|LM/LDHT.h|LM/LDHT.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="TranslationModel/fuzzy-match/FuzzyMatchWrapper.cpp|TranslationModel/CompactPT|LM/NeuralLMWrapper.cpp|FF/PhraseLengthFeatureTest.cpp|PhraseLengthFeatureTest.cpp|LM/BackwardTest.cpp|LM/BackwardLMState.h|LM/BackwardLMState.cpp|LM/Backward.h|LM/Backward.cpp|FeatureVectorTest.cpp|LM/ParallelBackoff.h|LM/ParallelBackoff.cpp|src/SyntacticLanguageModelState.h|src/SyntacticLanguageModelFiles.h|src/SyntacticLanguageModel.h|src/SyntacticLanguageModel.cpp|src/LM/SRI.h|src/LM/SRI.cpp|src/LM/Rand.h|src/LM/Rand.cpp|src/LM/LDHT.h|src/LM/LDHT.cpp|SyntacticLanguageModelState.h|SyntacticLanguageModelFiles.h|SyntacticLanguageModel.h|SyntacticLanguageModel.cpp|LM/LDHT.h|LM/LDHT.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@ -90,13 +93,13 @@
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.401150096" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -32,7 +32,21 @@ void ProbingPT::Load()
|
||||
|
||||
m_unkId = 456456546456;
|
||||
|
||||
// vocab
|
||||
// source vocab
|
||||
const std::map<uint64_t, std::string> &sourceVocab = m_engine->getSourceVocab();
|
||||
std::map<uint64_t, std::string>::const_iterator iter;
|
||||
for (iter = sourceVocab.begin(); iter != sourceVocab.end(); ++iter) {
|
||||
const string &wordStr = iter->second;
|
||||
const Factor *factor = FactorCollection::Instance().AddFactor(wordStr);
|
||||
|
||||
uint64_t probingId = iter->first;
|
||||
|
||||
SourceVocabMap::value_type entry(factor, probingId);
|
||||
m_sourceVocabMap.insert(entry);
|
||||
|
||||
}
|
||||
|
||||
// target vocab
|
||||
const std::map<unsigned int, std::string> &probingVocab = m_engine->getVocab();
|
||||
std::map<unsigned int, std::string>::const_iterator iter;
|
||||
for (iter = probingVocab.begin(); iter != probingVocab.end(); ++iter) {
|
||||
@ -41,7 +55,7 @@ void ProbingPT::Load()
|
||||
|
||||
unsigned int probingId = iter->first;
|
||||
|
||||
VocabMap::value_type entry(factor, probingId);
|
||||
TargetVocabMap::value_type entry(factor, probingId);
|
||||
m_vocabMap.insert(entry);
|
||||
|
||||
}
|
||||
@ -173,7 +187,7 @@ TargetPhrase *ProbingPT::CreateTargetPhrase(const Phrase &sourcePhrase, const ta
|
||||
|
||||
const Factor *ProbingPT::GetFactor(uint64_t probingId) const
|
||||
{
|
||||
VocabMap::right_map::const_iterator iter;
|
||||
TargetVocabMap::right_map::const_iterator iter;
|
||||
iter = m_vocabMap.right.find(probingId);
|
||||
if (iter != m_vocabMap.right.end()) {
|
||||
return iter->second;
|
||||
@ -186,7 +200,7 @@ const Factor *ProbingPT::GetFactor(uint64_t probingId) const
|
||||
|
||||
uint64_t ProbingPT::GetProbingId(const Factor *factor) const
|
||||
{
|
||||
VocabMap::left_map::const_iterator iter;
|
||||
TargetVocabMap::left_map::const_iterator iter;
|
||||
iter = m_vocabMap.left.find(factor);
|
||||
if (iter != m_vocabMap.left.end()) {
|
||||
return iter->second;
|
||||
|
@ -37,8 +37,11 @@ public:
|
||||
protected:
|
||||
QueryEngine *m_engine;
|
||||
|
||||
typedef boost::bimap<const Factor *, unsigned int> VocabMap;
|
||||
mutable VocabMap m_vocabMap;
|
||||
typedef boost::bimap<const Factor *, uint64_t> SourceVocabMap;
|
||||
mutable SourceVocabMap m_sourceVocabMap;
|
||||
|
||||
typedef boost::bimap<const Factor *, unsigned int> TargetVocabMap;
|
||||
mutable TargetVocabMap m_vocabMap;
|
||||
|
||||
TargetPhraseCollection *CreateTargetPhrase(const Phrase &sourcePhrase) const;
|
||||
TargetPhrase *CreateTargetPhrase(const Phrase &sourcePhrase, const target_text &probingTargetPhrase) const;
|
||||
|
Loading…
Reference in New Issue
Block a user