daily automatic beautifier

This commit is contained in:
MosesAdmin 2015-06-04 13:41:46 +01:00
parent 0e11919ffb
commit 5696a59ae4
20 changed files with 117 additions and 118 deletions

View File

@ -67,7 +67,9 @@ private:
protected: protected:
/// For child classes only: retrieve filebuf. /// For child classes only: retrieve filebuf.
__gnu_cxx::stdio_filebuf<char> *get_filebuf() { return _filebuf; } __gnu_cxx::stdio_filebuf<char> *get_filebuf() {
return _filebuf;
}
}; };
class ifdstream : public _fdstream class ifdstream : public _fdstream

View File

@ -55,9 +55,9 @@ int main(int argc, char** argv)
size_t quantize = 0; size_t quantize = 0;
size_t threads = size_t threads =
#ifdef WITH_THREADS #ifdef WITH_THREADS
boost::thread::hardware_concurrency() ? boost::thread::hardware_concurrency() : boost::thread::hardware_concurrency() ? boost::thread::hardware_concurrency() :
#endif #endif
1; 1;
if(1 >= argc) { if(1 >= argc) {

View File

@ -68,9 +68,9 @@ int main(int argc, char **argv)
size_t sortScoreIndex = 2; size_t sortScoreIndex = 2;
bool warnMe = true; bool warnMe = true;
size_t threads = size_t threads =
#ifdef WITH_THREADS #ifdef WITH_THREADS
boost::thread::hardware_concurrency() ? boost::thread::hardware_concurrency() : boost::thread::hardware_concurrency() ? boost::thread::hardware_concurrency() :
#endif #endif
1; 1;
if(1 >= argc) { if(1 >= argc) {

View File

@ -303,8 +303,7 @@ ReadInput()
boost::lock_guard<boost::mutex> lock(m_lock); boost::lock_guard<boost::mutex> lock(m_lock);
#endif #endif
boost::shared_ptr<InputType> source = GetBufferedInput(); boost::shared_ptr<InputType> source = GetBufferedInput();
if (source) if (source) {
{
source->SetTranslationId(m_currentLine++); source->SetTranslationId(m_currentLine++);
if (m_look_ahead || m_look_back) if (m_look_ahead || m_look_back)
this->set_context_for(*source); this->set_context_for(*source);

View File

@ -621,8 +621,7 @@ bool StaticData::LoadData(Parameter *parameter)
#ifdef HAVE_PROTOBUF #ifdef HAVE_PROTOBUF
|| m_outputSearchGraphPB || m_outputSearchGraphPB
#endif #endif
|| m_latticeSamplesFilePath.size()) || m_latticeSamplesFilePath.size()) {
{
m_nbest_options.enabled = true; m_nbest_options.enabled = true;
} }

View File

@ -1,18 +1,18 @@
#include "BookkeepingOptions.h" #include "BookkeepingOptions.h"
namespace Moses { namespace Moses
bool {
BookkeepingOptions:: bool
init(Parameter const& P) BookkeepingOptions::
{ init(Parameter const& P)
{
bool& x = need_alignment_info; bool& x = need_alignment_info;
P.SetParameter(x, "print-alignment-info", false); P.SetParameter(x, "print-alignment-info", false);
if (!x) P.SetParameter(x, "print-alignment-info-in-n-best", false); if (!x) P.SetParameter(x, "print-alignment-info-in-n-best", false);
if (!x) if (!x) {
{
PARAM_VEC const* params = P.GetParam("alignment-output-file"); PARAM_VEC const* params = P.GetParam("alignment-output-file");
x = params && params->size(); x = params && params->size();
} }
return true; return true;
} }
} }

View File

@ -2,13 +2,13 @@
#include "moses/Parameter.h" #include "moses/Parameter.h"
// #include <string> // #include <string>
namespace Moses { namespace Moses
{
struct BookkeepingOptions struct BookkeepingOptions {
{
bool need_alignment_info; bool need_alignment_info;
bool init(Parameter const& param); bool init(Parameter const& param);
}; };

View File

@ -2,7 +2,8 @@
#include "moses/Parameter.h" #include "moses/Parameter.h"
#include "NBestOptions.h" #include "NBestOptions.h"
namespace Moses { namespace Moses
{
bool bool
NBestOptions:: NBestOptions::
@ -10,21 +11,16 @@ init(Parameter const& P)
{ {
const PARAM_VEC *params; const PARAM_VEC *params;
params = P.GetParam("n-best-list"); params = P.GetParam("n-best-list");
if (params) if (params) {
{ if (params->size() >= 2) {
if (params->size() >= 2)
{
output_file_path = params->at(0); output_file_path = params->at(0);
nbest_size = Scan<size_t>( params->at(1) ); nbest_size = Scan<size_t>( params->at(1) );
only_distinct = (params->size()>2 && params->at(2)=="distinct"); only_distinct = (params->size()>2 && params->at(2)=="distinct");
} } else {
else
{
std::cerr << "wrong format for switch -n-best-list file size [disinct]"; std::cerr << "wrong format for switch -n-best-list file size [disinct]";
return false; return false;
} }
} } else nbest_size = 0;
else nbest_size = 0;
P.SetParameter<size_t>(factor, "n-best-factor", 20); P.SetParameter<size_t>(factor, "n-best-factor", 20);
P.SetParameter(include_alignment_info, "print-alignment-info-in-n-best", false ); P.SetParameter(include_alignment_info, "print-alignment-info-in-n-best", false );

View File

@ -1,10 +1,10 @@
// -*- mode: c++; cc-style: gnu -*- // -*- mode: c++; cc-style: gnu -*-
#include <string> #include <string>
namespace Moses { namespace Moses
{
struct NBestOptions struct NBestOptions {
{
size_t nbest_size; size_t nbest_size;
size_t factor; size_t factor;
bool enabled; bool enabled;
@ -22,6 +22,6 @@ namespace Moses {
bool init(Parameter const& param); bool init(Parameter const& param);
}; };
} }

View File

@ -22,7 +22,8 @@
#include <map> #include <map>
#include <string> #include <string>
namespace MosesTraining { namespace MosesTraining
{
struct SyntaxNode { struct SyntaxNode {
typedef std::map<std::string, std::string> AttributeMap; typedef std::map<std::string, std::string> AttributeMap;

View File

@ -51,7 +51,9 @@ public:
const std::vector< SyntaxNode* >& GetNodes( int startPos, int endPos ) const; const std::vector< SyntaxNode* >& GetNodes( int startPos, int endPos ) const;
//! Get a vector of pointers to all SyntaxNodes (unordered). //! Get a vector of pointers to all SyntaxNodes (unordered).
const std::vector< SyntaxNode* >& GetAllNodes() { return m_nodes; }; const std::vector< SyntaxNode* >& GetAllNodes() {
return m_nodes;
};
size_t GetNumWords() const { size_t GetNumWords() const {
return m_numWords; return m_numWords;