2010-07-18 03:23:09 +04:00
|
|
|
// $Id$
|
2010-04-12 14:15:49 +04:00
|
|
|
// vim:tabstop=2
|
|
|
|
/***********************************************************************
|
|
|
|
Moses - factored phrase-based language decoder
|
|
|
|
Copyright (C) 2010 Hieu Hoang
|
2011-02-24 15:36:50 +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 15:36:50 +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 15:36:50 +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 "ChartCellCollection.h"
|
2011-03-11 16:08:43 +03:00
|
|
|
#include "InputType.h"
|
|
|
|
#include "WordsRange.h"
|
2010-04-08 21:16:10 +04:00
|
|
|
|
2011-03-11 16:08:43 +03:00
|
|
|
namespace Moses
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-03-11 19:28:36 +03:00
|
|
|
ChartCellCollection::ChartCellCollection(const InputType &input, ChartManager &manager)
|
2011-02-24 15:36:50 +03:00
|
|
|
:m_hypoStackColl(input.GetSize())
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-02-24 15:36:50 +03:00
|
|
|
size_t size = input.GetSize();
|
|
|
|
for (size_t startPos = 0; startPos < size; ++startPos) {
|
|
|
|
InnerCollType &inner = m_hypoStackColl[startPos];
|
|
|
|
inner.resize(size - startPos);
|
|
|
|
|
|
|
|
size_t ind = 0;
|
|
|
|
for (size_t endPos = startPos ; endPos < size; ++endPos) {
|
|
|
|
ChartCell *cell = new ChartCell(startPos, endPos, manager);
|
|
|
|
inner[ind] = cell;
|
|
|
|
++ind;
|
|
|
|
}
|
|
|
|
}
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ChartCellCollection::~ChartCellCollection()
|
|
|
|
{
|
2011-02-24 15:36:50 +03:00
|
|
|
OuterCollType::iterator iter;
|
|
|
|
for (iter = m_hypoStackColl.begin(); iter != m_hypoStackColl.end(); ++iter) {
|
|
|
|
InnerCollType &inner = *iter;
|
2011-03-11 19:28:36 +03:00
|
|
|
RemoveAllInColl(inner);
|
2011-02-24 15:36:50 +03:00
|
|
|
}
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|