2011-11-21 20:21:04 +04:00
|
|
|
/***********************************************************************
|
|
|
|
Moses - statistical machine translation system
|
|
|
|
Copyright (C) 2006-2011 University of Edinburgh
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2011-11-21 20:21:04 +04:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2011-11-21 20:21:04 +04:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2011-11-21 20:21:04 +04:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <ostream>
|
|
|
|
|
2015-06-01 18:40:35 +03:00
|
|
|
#include "Subgraph.h"
|
|
|
|
|
|
|
|
namespace MosesTraining
|
2013-05-29 21:16:15 +04:00
|
|
|
{
|
2015-07-06 16:41:34 +03:00
|
|
|
namespace Syntax
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
namespace GHKM
|
|
|
|
{
|
2011-11-21 20:21:04 +04:00
|
|
|
|
2012-05-05 13:51:12 +04:00
|
|
|
struct Options;
|
2011-11-21 20:21:04 +04:00
|
|
|
class ScfgRule;
|
2014-11-12 17:03:24 +03:00
|
|
|
class Symbol;
|
2011-11-21 20:21:04 +04:00
|
|
|
|
|
|
|
class ScfgRuleWriter
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
public:
|
2011-11-21 20:21:04 +04:00
|
|
|
ScfgRuleWriter(std::ostream &fwd, std::ostream &inv, const Options &options)
|
2013-05-29 21:16:15 +04:00
|
|
|
: m_fwd(fwd)
|
|
|
|
, m_inv(inv)
|
|
|
|
, m_options(options) {}
|
2011-11-21 20:21:04 +04:00
|
|
|
|
2015-01-21 00:36:55 +03:00
|
|
|
void Write(const ScfgRule &rule, size_t lineNum, bool printEndl=true);
|
2011-11-21 20:21:04 +04:00
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
private:
|
2011-11-21 20:21:04 +04:00
|
|
|
// Disallow copying
|
|
|
|
ScfgRuleWriter(const ScfgRuleWriter &);
|
|
|
|
ScfgRuleWriter &operator=(const ScfgRuleWriter &);
|
|
|
|
|
2012-05-25 20:29:47 +04:00
|
|
|
void WriteStandardFormat(const ScfgRule &, std::ostream &, std::ostream &);
|
|
|
|
void WriteUnpairedFormat(const ScfgRule &, std::ostream &, std::ostream &);
|
2011-11-21 20:21:04 +04:00
|
|
|
void WriteSymbol(const Symbol &, std::ostream &);
|
|
|
|
|
|
|
|
std::ostream &m_fwd;
|
|
|
|
std::ostream &m_inv;
|
|
|
|
const Options &m_options;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace GHKM
|
2015-07-06 16:41:34 +03:00
|
|
|
} // namespace Syntax
|
2015-06-01 18:40:35 +03:00
|
|
|
} // namespace MosesTraining
|