mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
Merge branch 'master' of github.com:moses-smt/mosesdecoder
This commit is contained in:
commit
1c4df9fc5e
@ -67,7 +67,9 @@ private:
|
||||
|
||||
protected:
|
||||
/// 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
|
||||
|
@ -55,9 +55,9 @@ int main(int argc, char** argv)
|
||||
size_t quantize = 0;
|
||||
|
||||
size_t threads =
|
||||
#ifdef WITH_THREADS
|
||||
#ifdef WITH_THREADS
|
||||
boost::thread::hardware_concurrency() ? boost::thread::hardware_concurrency() :
|
||||
#endif
|
||||
#endif
|
||||
1;
|
||||
|
||||
if(1 >= argc) {
|
||||
|
@ -68,9 +68,9 @@ int main(int argc, char **argv)
|
||||
size_t sortScoreIndex = 2;
|
||||
bool warnMe = true;
|
||||
size_t threads =
|
||||
#ifdef WITH_THREADS
|
||||
#ifdef WITH_THREADS
|
||||
boost::thread::hardware_concurrency() ? boost::thread::hardware_concurrency() :
|
||||
#endif
|
||||
#endif
|
||||
1;
|
||||
|
||||
if(1 >= argc) {
|
||||
|
@ -303,8 +303,7 @@ ReadInput()
|
||||
boost::lock_guard<boost::mutex> lock(m_lock);
|
||||
#endif
|
||||
boost::shared_ptr<InputType> source = GetBufferedInput();
|
||||
if (source)
|
||||
{
|
||||
if (source) {
|
||||
source->SetTranslationId(m_currentLine++);
|
||||
if (m_look_ahead || m_look_back)
|
||||
this->set_context_for(*source);
|
||||
|
@ -621,8 +621,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
#ifdef HAVE_PROTOBUF
|
||||
|| m_outputSearchGraphPB
|
||||
#endif
|
||||
|| m_latticeSamplesFilePath.size())
|
||||
{
|
||||
|| m_latticeSamplesFilePath.size()) {
|
||||
m_nbest_options.enabled = true;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include "BookkeepingOptions.h"
|
||||
|
||||
namespace Moses {
|
||||
bool
|
||||
BookkeepingOptions::
|
||||
init(Parameter const& P)
|
||||
{
|
||||
namespace Moses
|
||||
{
|
||||
bool
|
||||
BookkeepingOptions::
|
||||
init(Parameter const& P)
|
||||
{
|
||||
bool& x = need_alignment_info;
|
||||
P.SetParameter(x, "print-alignment-info", 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");
|
||||
x = params && params->size();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,13 @@
|
||||
#include "moses/Parameter.h"
|
||||
// #include <string>
|
||||
|
||||
namespace Moses {
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
struct BookkeepingOptions
|
||||
{
|
||||
struct BookkeepingOptions {
|
||||
bool need_alignment_info;
|
||||
bool init(Parameter const& param);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
#include "moses/Parameter.h"
|
||||
#include "NBestOptions.h"
|
||||
|
||||
namespace Moses {
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
bool
|
||||
NBestOptions::
|
||||
@ -10,21 +11,16 @@ init(Parameter const& P)
|
||||
{
|
||||
const PARAM_VEC *params;
|
||||
params = P.GetParam("n-best-list");
|
||||
if (params)
|
||||
{
|
||||
if (params->size() >= 2)
|
||||
{
|
||||
if (params) {
|
||||
if (params->size() >= 2) {
|
||||
output_file_path = params->at(0);
|
||||
nbest_size = Scan<size_t>( params->at(1) );
|
||||
only_distinct = (params->size()>2 && params->at(2)=="distinct");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
std::cerr << "wrong format for switch -n-best-list file size [disinct]";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else nbest_size = 0;
|
||||
} else nbest_size = 0;
|
||||
|
||||
P.SetParameter<size_t>(factor, "n-best-factor", 20);
|
||||
P.SetParameter(include_alignment_info, "print-alignment-info-in-n-best", false );
|
||||
|
@ -1,10 +1,10 @@
|
||||
// -*- mode: c++; cc-style: gnu -*-
|
||||
#include <string>
|
||||
|
||||
namespace Moses {
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
struct NBestOptions
|
||||
{
|
||||
struct NBestOptions {
|
||||
size_t nbest_size;
|
||||
size_t factor;
|
||||
bool enabled;
|
||||
@ -22,6 +22,6 @@ namespace Moses {
|
||||
|
||||
bool init(Parameter const& param);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,8 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace MosesTraining {
|
||||
namespace MosesTraining
|
||||
{
|
||||
|
||||
struct SyntaxNode {
|
||||
typedef std::map<std::string, std::string> AttributeMap;
|
||||
|
@ -51,7 +51,9 @@ public:
|
||||
const std::vector< SyntaxNode* >& GetNodes( int startPos, int endPos ) const;
|
||||
|
||||
//! 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 {
|
||||
return m_numWords;
|
||||
|
Loading…
Reference in New Issue
Block a user