mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
probing hash pt compiles. Need to hook up vocab
This commit is contained in:
parent
63b9eac201
commit
e505a462a7
@ -48,6 +48,7 @@
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.816413868" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
|
||||
<option id="gnu.cpp.link.option.paths.330225535" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../nplm/lib""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../probingPT/helpers""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../boost/lib64""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../DALM/lib""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../cmph/lib""/>
|
||||
@ -68,6 +69,7 @@
|
||||
<option id="gnu.cpp.link.option.libs.1177721357" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="moses"/>
|
||||
<listOptionValue builtIn="false" value="irstlm"/>
|
||||
<listOptionValue builtIn="false" value="probingPT"/>
|
||||
<listOptionValue builtIn="false" value="dstruct"/>
|
||||
<listOptionValue builtIn="false" value="dalm"/>
|
||||
<listOptionValue builtIn="false" value="MurmurHash3"/>
|
||||
@ -81,6 +83,7 @@
|
||||
<listOptionValue builtIn="false" value="lm"/>
|
||||
<listOptionValue builtIn="false" value="util"/>
|
||||
<listOptionValue builtIn="false" value="boost_iostreams-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_serialization"/>
|
||||
<listOptionValue builtIn="false" value="boost_system-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
|
||||
|
@ -47,6 +47,7 @@
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1546774818" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
|
||||
<option id="gnu.cpp.link.option.paths.523170942" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../irstlm/lib""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../probingPT/helpers""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../DALM/lib""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../nplm/lib""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:}/../../randlm/lib""/>
|
||||
@ -65,6 +66,7 @@
|
||||
<option id="gnu.cpp.link.option.libs.998577284" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="moses"/>
|
||||
<listOptionValue builtIn="false" value="irstlm"/>
|
||||
<listOptionValue builtIn="false" value="probingPT"/>
|
||||
<listOptionValue builtIn="false" value="dstruct"/>
|
||||
<listOptionValue builtIn="false" value="flm"/>
|
||||
<listOptionValue builtIn="false" value="oolm"/>
|
||||
@ -78,6 +80,7 @@
|
||||
<listOptionValue builtIn="false" value="lm"/>
|
||||
<listOptionValue builtIn="false" value="util"/>
|
||||
<listOptionValue builtIn="false" value="boost_iostreams-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_serialization"/>
|
||||
<listOptionValue builtIn="false" value="boost_system-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
|
||||
@ -180,4 +183,5 @@
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
|
@ -1106,11 +1106,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ExternalFeature.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/FF</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/FFState.cpp</name>
|
||||
<type>1</type>
|
||||
@ -1781,16 +1776,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/lm.log</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/FF/HyperParameterAsWeight.cpp</name>
|
||||
<type>1</type>
|
||||
<location>/Users/hieu/unison/workspace/github/mosesdecoder/moses/FF/HyperParameterAsWeight.cpp</location>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/FF/HyperParameterAsWeight.h</name>
|
||||
<type>1</type>
|
||||
<location>/Users/hieu/unison/workspace/github/mosesdecoder/moses/FF/HyperParameterAsWeight.h</location>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/LexicalReordering/LexicalReordering.cpp</name>
|
||||
<type>1</type>
|
||||
|
@ -47,9 +47,7 @@ void ProbingPT::GetTargetPhraseCollectionBatch(const InputPathList &inputPathQue
|
||||
InputPath &inputPath = **iter;
|
||||
const Phrase &sourcePhrase = inputPath.GetPhrase();
|
||||
|
||||
TargetPhrase *tp = CreateTargetPhrase(sourcePhrase);
|
||||
TargetPhraseCollection *tpColl = new TargetPhraseCollection();
|
||||
tpColl->Add(tp);
|
||||
TargetPhraseCollection *tpColl = CreateTargetPhrase(sourcePhrase);
|
||||
|
||||
// add target phrase to phrase-table cache
|
||||
size_t hash = hash_value(sourcePhrase);
|
||||
@ -60,30 +58,52 @@ void ProbingPT::GetTargetPhraseCollectionBatch(const InputPathList &inputPathQue
|
||||
}
|
||||
}
|
||||
|
||||
TargetPhrase *ProbingPT::CreateTargetPhrase(const Phrase &sourcePhrase) const
|
||||
TargetPhraseCollection *ProbingPT::CreateTargetPhrase(const Phrase &sourcePhrase) const
|
||||
{
|
||||
// create a target phrase from the 1st word of the source, prefix with 'ProbingPT:'
|
||||
assert(sourcePhrase.GetSize());
|
||||
|
||||
vector<uint64_t> source;
|
||||
std::pair<bool, std::vector<target_text>> query_result;
|
||||
std::pair<bool, std::vector<target_text> > query_result;
|
||||
|
||||
TargetPhraseCollection *tpColl = NULL;
|
||||
|
||||
//Actual lookup
|
||||
std::string cinstr = "adsadsadas fasdasd sad sadasd";
|
||||
query_result = queries.query(source);
|
||||
std::string cinstr = sourcePhrase.ToString();
|
||||
query_result = m_engine->query(source);
|
||||
|
||||
if (query_result.first) {
|
||||
queries.printTargetInfo(query_result.second);
|
||||
} else {
|
||||
std::cout << "Key not found!" << std::endl;
|
||||
m_engine->printTargetInfo(query_result.second);
|
||||
tpColl = new TargetPhraseCollection();
|
||||
|
||||
const std::vector<target_text> &probingTargetPhrases = query_result.second;
|
||||
for (size_t i = 0; i < probingTargetPhrases.size(); ++i) {
|
||||
const target_text &probingTargetPhrase = probingTargetPhrases[i];
|
||||
TargetPhrase *tp = CreateTargetPhrase(sourcePhrase, probingTargetPhrase);
|
||||
|
||||
tpColl->Add(tp);
|
||||
}
|
||||
|
||||
string str = sourcePhrase.GetWord(0).GetFactor(0)->GetString().as_string();
|
||||
str = "ProbingPT:" + str;
|
||||
} else {
|
||||
std::cerr << "Key not found!" << std::endl;
|
||||
}
|
||||
|
||||
return tpColl;
|
||||
}
|
||||
|
||||
TargetPhrase *ProbingPT::CreateTargetPhrase(const Phrase &sourcePhrase, const target_text &probingTargetPhrase) const
|
||||
{
|
||||
const std::vector<uint64_t> &probingPhrase = probingTargetPhrase.target_phrase;
|
||||
size_t size = probingPhrase.size();
|
||||
|
||||
TargetPhrase *tp = new TargetPhrase();
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
string str; // TODO get string from vocab id. Preferably create map<id, factor>
|
||||
|
||||
Word &word = tp->AddWord();
|
||||
word.CreateFromString(Output, m_output, str, false);
|
||||
}
|
||||
|
||||
// score for this phrase table
|
||||
vector<float> scores(m_numScoreComponents, 1.3);
|
||||
@ -91,8 +111,6 @@ TargetPhrase *ProbingPT::CreateTargetPhrase(const Phrase &sourcePhrase) const
|
||||
|
||||
// score of all other ff when this rule is being loaded
|
||||
tp->Evaluate(sourcePhrase, GetFeaturesToApply());
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
ChartRuleLookupManager* ProbingPT::CreateRuleLookupManager(const ChartParser &parser,
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "PhraseDictionary.h"
|
||||
|
||||
class QueryEngine;
|
||||
class target_text;
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
@ -35,7 +36,8 @@ public:
|
||||
protected:
|
||||
QueryEngine *m_engine;
|
||||
|
||||
TargetPhrase *CreateTargetPhrase(const Phrase &sourcePhrase) const;
|
||||
TargetPhraseCollection *CreateTargetPhrase(const Phrase &sourcePhrase) const;
|
||||
TargetPhrase *CreateTargetPhrase(const Phrase &sourcePhrase, const target_text &probingTargetPhrase) const;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user