2010-07-18 03:23:09 +04:00
|
|
|
// $Id$
|
2010-04-12 14:15:49 +04:00
|
|
|
/***********************************************************************
|
|
|
|
Moses - factored phrase-based language decoder
|
|
|
|
Copyright (C) 2010 Hieu Hoang
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2010-04-12 14:15:49 +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.
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2010-04-12 14:15:49 +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.
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2010-04-12 14:15:49 +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
|
|
|
|
***********************************************************************/
|
2010-04-08 21:16:10 +04:00
|
|
|
#include "DotChart.h"
|
|
|
|
#include "Util.h"
|
|
|
|
|
2010-09-10 19:19:25 +04:00
|
|
|
#include <algorithm>
|
|
|
|
|
2010-04-08 21:16:10 +04:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
2011-03-11 16:08:43 +03:00
|
|
|
DottedRuleColl::~DottedRuleColl()
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-02-07 18:43:19 +03:00
|
|
|
#ifdef USE_BOOST_POOL
|
2011-03-11 16:08:43 +03:00
|
|
|
// Do nothing. DottedRule objects are stored in object pools owned by
|
2011-02-07 18:43:19 +03:00
|
|
|
// the sentence-specific ChartRuleLookupManagers.
|
|
|
|
#else
|
|
|
|
std::for_each(m_coll.begin(), m_coll.end(),
|
|
|
|
RemoveAllInColl<CollType::value_type>);
|
|
|
|
#endif
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
2011-03-11 16:08:43 +03:00
|
|
|
std::ostream& operator<<(std::ostream &out, const DottedRule& /* rule */)
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-02-24 16:14:42 +03:00
|
|
|
//const PhraseDictionaryNode &node = rule.GetLastNode();
|
|
|
|
//out << node;
|
|
|
|
|
|
|
|
return out;
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
2011-03-11 16:08:43 +03:00
|
|
|
std::ostream& operator<<(std::ostream &out, const DottedRuleList &coll)
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-03-11 16:08:43 +03:00
|
|
|
DottedRuleList::const_iterator iter;
|
2011-02-24 16:14:42 +03:00
|
|
|
for (iter = coll.begin(); iter != coll.end(); ++iter) {
|
2011-03-11 16:08:43 +03:00
|
|
|
const DottedRule &rule = **iter;
|
2011-02-24 16:14:42 +03:00
|
|
|
out << rule << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return out;
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|