mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 06:52:34 +03:00
parse command line
This commit is contained in:
parent
a515289a75
commit
715af8bcad
@ -18,6 +18,8 @@ AlignedSentence::AlignedSentence(const std::string &source,
|
||||
const std::string &target,
|
||||
const std::string &alignment)
|
||||
{
|
||||
cerr << "plain text" << endl;
|
||||
|
||||
PopulateWordVec(m_source, source);
|
||||
PopulateWordVec(m_target, target);
|
||||
PopulateAlignment(alignment);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "AlignedSentenceSyntax.h"
|
||||
#include "Parameter.h"
|
||||
#include "pugixml/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
#include "moses/Util.h"
|
||||
|
||||
using namespace std;
|
||||
@ -20,7 +20,7 @@ AlignedSentenceSyntax::AlignedSentenceSyntax(const std::string &source,
|
||||
,m_targetStr(target)
|
||||
,m_alignmentStr(alignment)
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
cerr << "syntax" << endl;
|
||||
|
||||
}
|
||||
|
||||
|
@ -23,12 +23,38 @@ int main(int argc, char** argv)
|
||||
po::options_description desc("Options");
|
||||
desc.add_options()
|
||||
("help", "Print help messages")
|
||||
("add", "additional options")
|
||||
("revision,r", po::value<int>()->default_value(0), "Revision");
|
||||
("MaxSpan", po::value<int>()->default_value(params.maxSpan), "Max (source) span of a rule. ie. number of words in the source")
|
||||
("SourceSyntax", "Source sentence is a parse tree")
|
||||
("TargetSyntax", "Target sentence is a parse tree");
|
||||
|
||||
po::variables_map vm;
|
||||
try
|
||||
{
|
||||
po::store(po::parse_command_line(argc, argv, desc),
|
||||
vm); // can throw
|
||||
|
||||
/** --help option
|
||||
*/
|
||||
if ( vm.count("help") || argc < 5 )
|
||||
{
|
||||
std::cout << "Basic Command Line Parameter App" << std::endl
|
||||
<< desc << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
po::notify(vm); // throws on error, so do after help in case
|
||||
// there are any problems
|
||||
}
|
||||
catch(po::error& e)
|
||||
{
|
||||
std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
|
||||
std::cerr << desc << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (vm.count("maxSpan")) params.maxSpan = vm["maxSpan"].as<int>();
|
||||
if (vm.count("SourceSyntax")) params.sourceSyntax = true;
|
||||
if (vm.count("TargetSyntax")) params.targetSyntax = true;
|
||||
|
||||
// input files;
|
||||
string pathTarget = argv[1];
|
||||
|
@ -8,7 +8,7 @@ clean:
|
||||
|
||||
OBJECTS = AlignedSentence.o ConsistentPhrase.o ConsistentPhrases.o InputFileStream.o \
|
||||
Main.o OutputFileStream.o Parameter.o Phrase.o Rule.o Rules.o RuleSymbol.o \
|
||||
SyntaxTree.o Word.o NonTerm.o RulePhrase.o AlignedSentenceSyntax.o pugixml/pugixml.o
|
||||
SyntaxTree.o Word.o NonTerm.o RulePhrase.o AlignedSentenceSyntax.o pugixml.o
|
||||
|
||||
extract-mixed-syntax: $(OBJECTS)
|
||||
|
||||
|
@ -16,7 +16,7 @@ Parameter::Parameter()
|
||||
,requireAlignedWord(true)
|
||||
,fractionalCounting(true)
|
||||
|
||||
,sourceSyntax(true)
|
||||
,sourceSyntax(false)
|
||||
,targetSyntax(false)
|
||||
{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user