diff options
author | redpony <redpony@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-09-24 20:48:23 +0400 |
---|---|---|
committer | redpony <redpony@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-09-24 20:48:23 +0400 |
commit | 232dc9889cb272cd63f2c407c62b5247dd9a54fb (patch) | |
tree | e1f0f8556f001017f418697dccdf212988589b18 /moses-cmd | |
parent | bb0ade93f7da75c70a23a588cd26ef85cca90329 (diff) |
enable moses to accept a file that lists feature name and weight pairs.
enable moses to export its search graph as a phrase lattice encoded serialized in a Google protocol buffer. This requires protoc (http://code.google.com/p/protobuf/) to function, disabled by default.
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1890 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/src/Main.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/moses-cmd/src/Main.cpp b/moses-cmd/src/Main.cpp index 281b8b043..c02126fb5 100644 --- a/moses-cmd/src/Main.cpp +++ b/moses-cmd/src/Main.cpp @@ -55,9 +55,10 @@ POSSIBILITY OF SUCH DAMAGE. #if HAVE_CONFIG_H #include "config.h" -#else -// those not using autoconf have to build MySQL support for now -# define USE_MYSQL 1 +#endif + +#ifdef HAVE_PROTOBUF +#include "hypergraph.pb.h" #endif using namespace std; @@ -78,6 +79,9 @@ bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source int main(int argc, char* argv[]) { +#ifdef HAVE_PROTOBUF + GOOGLE_PROTOBUF_VERIFY_VERSION; +#endif IFVERBOSE(1) { TRACE_ERR("command: "); @@ -143,6 +147,17 @@ int main(int argc, char* argv[]) if (staticData.GetOutputSearchGraph()) manager.GetSearchGraph(source->GetTranslationId(), ioWrapper->GetOutputSearchGraphStream()); +#ifdef HAVE_PROTOBUF + if (staticData.GetOutputSearchGraphPB()) { + ostringstream sfn; + sfn << staticData.GetParam("output-search-graph-pb")[0] << '/' << source->GetTranslationId() << ".pb" << ends; + string fn = sfn.str(); + VERBOSE(2, "Writing search graph to " << fn << endl); + fstream output(fn.c_str(), ios::trunc | ios::binary | ios::out); + manager.SerializeSearchGraphPB(source->GetTranslationId(), output); + } +#endif + // pick best translation (maximum a posteriori decoding) if (! staticData.UseMBR()) { ioWrapper->OutputBestHypo(manager.GetBestHypothesis(), source->GetTranslationId(), |