throw exception if unknown argument

This commit is contained in:
Hieu Hoang 2013-02-19 17:31:11 +00:00
parent 711bdf1b71
commit e0746cd525
15 changed files with 26 additions and 31 deletions

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.162355801">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.162355801" moduleId="org.eclipse.cdt.core.settings" name="Debug">
@ -76,6 +74,7 @@
<listOptionValue builtIn="false" value="boost_system-mt"/>
<listOptionValue builtIn="false" value="boost_thread-mt"/>
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
<listOptionValue builtIn="false" value="rt"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.128214028" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.461114338">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.461114338" moduleId="org.eclipse.cdt.core.settings" name="Debug">
@ -74,6 +72,7 @@
<listOptionValue builtIn="false" value="boost_thread-mt"/>
<listOptionValue builtIn="false" value="lm"/>
<listOptionValue builtIn="false" value="util"/>
<listOptionValue builtIn="false" value="rt"/>
</option>
<option id="gnu.cpp.link.option.userobjs.1542590830" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;${workspace_loc}/../../boost/lib64/libboost_system-mt.a&quot;"/>

View File

@ -33,7 +33,6 @@ namespace Moses
/** Singleton collection of all AlignmentInfo objects.
* Used as a cache of all alignment info to save space.
* @todo Check whether this needs locking in threaded environment
*/
class AlignmentInfoCollection
{

View File

@ -32,8 +32,7 @@ namespace Moses
{
/**
* A feature on the decoding path (Generation or Translation)
* @todo don't quite understand what this is
* Baseclass for phrase-table or generation table feature function
**/
class DecodeFeature : public StatelessFeatureFunction {

View File

@ -8,8 +8,6 @@
namespace Moses
{
/** @todo What is the difference between this and the classes in FeatureFunction?
*/
class FFState
{
public:

View File

@ -17,9 +17,8 @@ GlobalLexicalModel::GlobalLexicalModel(const std::string &line)
string filePath;
vector<FactorType> inputFactors, outputFactors;
vector<string> toks = Tokenize(line);
for (size_t i = 0; i < toks.size(); ++i) {
vector<string> args = Tokenize(toks[i], "=");
for (size_t i = 0; i < m_args.size(); ++i) {
const vector<string> &args = m_args[i];
if (args[0] == "file") {
CHECK(args.size() == 2);
@ -31,6 +30,9 @@ GlobalLexicalModel::GlobalLexicalModel(const std::string &line)
else if (args[0] == "outputFactors") {
outputFactors = Tokenize<FactorType>(args[1],",");
}
else {
throw "Unknown argument " + args[0];
}
}
// load model

View File

@ -61,8 +61,7 @@ LanguageModelIRST::LanguageModelIRST(const std::string &line)
filePath = args[1];
}
else {
UserMessage::Add("Unknown argument " + args[0]);
abort();
throw "Unknown argument " + args[0];
}
}

View File

@ -362,8 +362,7 @@ LanguageModel *ConstructKenLM(const std::string &description, const std::string
lazy = Scan<bool>(args[1]);
}
else {
UserMessage::Add("Unknown argument " + args[0]);
abort();
throw "Unknown argument " + args[0];
}
}

View File

@ -34,6 +34,9 @@ LexicalReordering::LexicalReordering(const std::string &line)
else if (args[0] == "path") {
filePath = args[1];
}
else {
throw "Unknown argument " + args[0];
}
}
switch(m_configuration->GetCondition()) {

View File

@ -308,13 +308,6 @@ Scores LexicalReorderingTableTree::auxFindScoreForContext(const Candidates& cand
}
}
/*
void LexicalReorderingTableTree::DbgDump(std::ostream* pout){
std::ostream& out = *pout;
//TODO!
}
*/
void LexicalReorderingTableTree::InitializeForInput(const InputType& input)
{
ClearCache();

View File

@ -28,7 +28,9 @@ PhraseBoundaryFeature::PhraseBoundaryFeature(const std::string &line)
else if (args[0] == "target") {
m_targetFactors = Tokenize<FactorType>(args[1], ",");
}
else {
throw "Unknown argument " + args[0];
}
}
}

View File

@ -30,8 +30,7 @@ m_unrestricted(true)
filename = args[1];
}
else {
UserMessage::Add("Unknown argument " + args[0]);
abort();
throw "Unknown argument " + args[0];
}
}

View File

@ -29,7 +29,9 @@ m_unrestricted(true)
else if (args[0] == "path") {
filename = args[1];
}
else {
throw "Unknown argument " + args[0];
}
}
// load word list for restricted feature set

View File

@ -82,8 +82,7 @@ PhraseDictionaryFeature::PhraseDictionaryFeature(const std::string &line)
m_alignmentsFile = args[1];
}
else {
UserMessage::Add("Unknown argument " + args[0]);
abort();
throw "Unknown argument " + args[0];
}
} // for (size_t i = 0; i < toks.size(); ++i) {

View File

@ -63,6 +63,9 @@ WordTranslationFeature::WordTranslationFeature(const std::string &line)
else if (args[0] == "target-path") {
filenameTarget = args[1];
}
else {
throw "Unknown argument " + args[0];
}
}
if (m_simple == 1) std::cerr << "using simple word translations.. ";