mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
daily automatic beautifier
This commit is contained in:
parent
0e11919ffb
commit
5696a59ae4
@ -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
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "BookkeepingOptions.h"
|
#include "BookkeepingOptions.h"
|
||||||
|
|
||||||
namespace Moses {
|
namespace Moses
|
||||||
|
{
|
||||||
bool
|
bool
|
||||||
BookkeepingOptions::
|
BookkeepingOptions::
|
||||||
init(Parameter const& P)
|
init(Parameter const& P)
|
||||||
@ -8,8 +9,7 @@ namespace Moses {
|
|||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#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);
|
||||||
};
|
};
|
||||||
|
@ -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 );
|
||||||
|
@ -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,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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user