00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <ostream>
00023
00024 #include "Subgraph.h"
00025
00026 namespace MosesTraining
00027 {
00028 namespace Syntax
00029 {
00030 namespace GHKM
00031 {
00032
00033 struct Options;
00034 class ScfgRule;
00035 class Symbol;
00036
00037 class ScfgRuleWriter
00038 {
00039 public:
00040 ScfgRuleWriter(std::ostream &fwd, std::ostream &inv, const Options &options)
00041 : m_fwd(fwd)
00042 , m_inv(inv)
00043 , m_options(options) {}
00044
00045 void Write(const ScfgRule &rule, size_t lineNum, bool printEndl=true);
00046
00047 private:
00048
00049 ScfgRuleWriter(const ScfgRuleWriter &);
00050 ScfgRuleWriter &operator=(const ScfgRuleWriter &);
00051
00052 void WriteStandardFormat(const ScfgRule &, std::ostream &, std::ostream &);
00053 void WriteUnpairedFormat(const ScfgRule &, std::ostream &, std::ostream &);
00054 void WriteSymbol(const Symbol &, std::ostream &);
00055
00056 std::ostream &m_fwd;
00057 std::ostream &m_inv;
00058 const Options &m_options;
00059 };
00060
00061 }
00062 }
00063 }