Merge branch 'weight-new' of github.com:hieuhoang/mosesdecoder into weight-new

This commit is contained in:
Hieu Hoang 2013-03-16 23:25:40 +00:00
commit 9c91eda308
7 changed files with 39 additions and 108 deletions

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?> <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings"> <storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.722547278"> <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.722547278">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.722547278" moduleId="org.eclipse.cdt.core.settings" name="Debug"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.722547278" moduleId="org.eclipse.cdt.core.settings" name="Debug">
@ -9,7 +7,7 @@
<externalSetting> <externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/search"/> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/search"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/search/Debug"/> <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/search/Debug"/>
<entry flags="RESOLVED" kind="libraryFile" name="search"/> <entry flags="RESOLVED" kind="libraryFile" name="search" srcPrefixMapping="" srcRootPath=""/>
</externalSetting> </externalSetting>
</externalSettings> </externalSettings>
<extensions> <extensions>
@ -26,11 +24,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.722547278." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.722547278." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1512691763" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1512691763" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.exe.debug.633526059" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/> <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.exe.debug.633526059" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<<<<<<< HEAD
<builder buildPath="${workspace_loc:/search/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.164367197" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="3" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
=======
<builder buildPath="${workspace_loc:/search/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.164367197" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/> <builder buildPath="${workspace_loc:/search/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.164367197" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
>>>>>>> df5f0934be559418177ffa9a68c2e561918a310f
<tool id="cdt.managedbuild.tool.gnu.archiver.base.854512708" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> <tool id="cdt.managedbuild.tool.gnu.archiver.base.854512708" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1096845166" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1096845166" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.240381177" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.240381177" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
@ -133,11 +127,6 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo> </scannerConfigBuildInfo>
</storageModule> </storageModule>
<<<<<<< HEAD
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/search"/>
</storageModule>
=======
<storageModule moduleId="refreshScope" versionNumber="2"> <storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release"> <configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/search"/> <resource resourceType="PROJECT" workspacePath="/search"/>
@ -147,5 +136,5 @@
</configuration> </configuration>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
>>>>>>> df5f0934be559418177ffa9a68c2e561918a310f
</cproject> </cproject>

View File

@ -23,7 +23,7 @@
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key> <key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j3</value> <value></value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key> <key>org.eclipse.cdt.make.core.buildCommand</key>
@ -91,11 +91,6 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/applied.hh</locationURI> <locationURI>PARENT-3-PROJECT_LOC/search/applied.hh</locationURI>
</link> </link>
<link>
<name>bin</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link> <link>
<name>config.hh</name> <name>config.hh</name>
<type>1</type> <type>1</type>
@ -163,61 +158,9 @@
</link> </link>
<link> <link>
<name>vertex_generator.hh</name> <name>vertex_generator.hh</name>
<<<<<<< HEAD
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/vertex_generator.hh</locationURI> <locationURI>PARENT-3-PROJECT_LOC/search/vertex_generator.hh</locationURI>
</link> </link>
<link>
<name>bin/gcc-4.5</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/edge_generator.o</name>
=======
>>>>>>> df5f0934be559418177ffa9a68c2e561918a310f
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/edge_generator.o</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/nbest.o</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/nbest.o</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/rule.o</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/rule.o</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/vertex.o</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/vertex.o</locationURI>
</link>
<link>
<name>bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/vertex_generator.o</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/search/bin/gcc-4.5/release/debug-symbols-on/link-static/threading-multi/vertex_generator.o</locationURI>
</link>
</linkedResources> </linkedResources>
</projectDescription> </projectDescription>

View File

@ -16,6 +16,13 @@ PT::PT(const std::string &line, int numFeatures, bool isHierarchical, const pair
outFactors = factors->second; outFactors = factors->second;
} }
if (inFactors.size() == 0) {
inFactors.push_back(0);
}
if (outFactors.size() == 0) {
outFactors.push_back(0);
}
int implementation; int implementation;
if (toks.size() > 1) if (toks.size() > 1)
implementation = Scan<int>(toks[1]); implementation = Scan<int>(toks[1]);

View File

@ -16,5 +16,12 @@ RO::RO(const std::string &line, const std::pair<Factors, Factors> *factors)
inFactors = factors->first; inFactors = factors->first;
outFactors = factors->second; outFactors = factors->second;
} }
if (inFactors.size() == 0) {
inFactors.push_back(0);
}
if (outFactors.size() == 0) {
outFactors.push_back(0);
}
} }

View File

@ -37,43 +37,14 @@ using namespace std;
namespace Moses namespace Moses
{ {
<<<<<<< HEAD
LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string& description, const std::string &line) LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string& description, const std::string &line)
:LanguageModelImplementation(description, line) :LanguageModelImplementation(description, line)
=======
LanguageModelSingleFactor::~LanguageModelSingleFactor()
{
}
struct PointerState : public FFState {
const void* lmstate;
PointerState(const void* lms) {
lmstate = lms;
}
int Compare(const FFState& o) const {
const PointerState& other = static_cast<const PointerState&>(o);
if (other.lmstate > lmstate) return 1;
else if (other.lmstate < lmstate) return -1;
return 0;
}
};
LanguageModelPointerState::LanguageModelPointerState()
>>>>>>> df5f0934be559418177ffa9a68c2e561918a310f
{ {
m_nullContextState = new PointerState(NULL); m_nullContextState = new PointerState(NULL);
m_beginSentenceState = new PointerState(NULL); m_beginSentenceState = new PointerState(NULL);
} }
<<<<<<< HEAD
LanguageModelSingleFactor::~LanguageModelSingleFactor() {} LanguageModelSingleFactor::~LanguageModelSingleFactor() {}
=======
LanguageModelPointerState::~LanguageModelPointerState()
{
delete m_nullContextState;
delete m_beginSentenceState;
}
>>>>>>> df5f0934be559418177ffa9a68c2e561918a310f
const FFState *LanguageModelSingleFactor::GetNullContextState() const const FFState *LanguageModelSingleFactor::GetNullContextState() const
{ {

View File

@ -52,11 +52,11 @@ PhraseDictionary::PhraseDictionary(const std::string &description, const std::st
const vector<string> &args = m_args[i]; const vector<string> &args = m_args[i];
if (args[0] == "input-factor") { if (args[0] == "input-factor") {
m_input =Tokenize<FactorType>(args[1]); m_input =Tokenize<FactorType>(args[1], ",");
m_inputFactors = FactorMask(m_input); m_inputFactors = FactorMask(m_input);
} }
else if (args[0] == "output-factor") { else if (args[0] == "output-factor") {
m_output =Tokenize<FactorType>(args[1]); m_output =Tokenize<FactorType>(args[1], ",");
m_outputFactors = FactorMask(m_output); m_outputFactors = FactorMask(m_output);
} }
else if (args[0] == "num-input-features") { else if (args[0] == "num-input-features") {

View File

@ -2085,13 +2085,27 @@ sub define_training_create_config {
my $moses_src_dir = &check_and_get("GENERAL:moses-src-dir"); my $moses_src_dir = &check_and_get("GENERAL:moses-src-dir");
my $cmd = "$moses_src_dir/bin/create-ini "; my $cmd = "$moses_src_dir/bin/create-ini ";
my %IN = &get_factor_id("input"); my %IN;
my %OUT = &get_factor_id("output"); my %OUT;
if (&backoff_and_get("TRAINING:input-factors")) {
%IN = &get_factor_id("input");
}
else {
$IN{"word"} = 0;
}
if (&backoff_and_get("TRAINING:output-factors")) {
%OUT = &get_factor_id("output");
}
else {
$OUT{"word"} = 0;
}
$cmd .= "-input-factor-max ".((scalar keys %IN)-1)." "; $cmd .= "-input-factor-max ".((scalar keys %IN)-1)." ";
$cmd .= "-translation-factors ". $cmd .= "-translation-factors ".
&encode_factor_definition("translation-factors",\%IN,\%OUT)." "; &encode_factor_definition("translation-factors",\%IN,\%OUT)." "
if &get("TRAINING:translation-factors");
$cmd .= "-reordering-factors ". $cmd .= "-reordering-factors ".
&encode_factor_definition("reordering-factors",\%IN,\%OUT)." " &encode_factor_definition("reordering-factors",\%IN,\%OUT)." "
if &get("TRAINING:reordering-factors"); if &get("TRAINING:reordering-factors");