00001 #pragma once
00002
00003 #include <ostream>
00004 #include <string>
00005
00006 #include "Forest.h"
00007 #include "Options.h"
00008
00009 namespace MosesTraining
00010 {
00011 namespace Syntax
00012 {
00013 namespace PostprocessEgretForests
00014 {
00015
00016 class ForestWriter
00017 {
00018 public:
00019 ForestWriter(const Options &options, std::ostream &out)
00020 : m_options(options), m_out(out) {}
00021
00022 void Write(const std::string &, const Forest &, std::size_t);
00023
00024 private:
00025 std::string Escape(const std::string &) const;
00026 std::string PossiblyEscape(const std::string &) const;
00027 void WriteHyperedgeLine(const Forest::Hyperedge &);
00028 void WriteVertex(const Forest::Vertex &);
00029
00030 const Options &m_options;
00031 std::ostream &m_out;
00032 };
00033
00034 }
00035 }
00036 }