📄 partialtransloptcoll.h.svn-base
字号:
// $Id$/***********************************************************************Moses - factored phrase-based language decoderCopyright (C) 2006 University of EdinburghThis library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA***********************************************************************/#pragma once#include <list>#include <iostream>#include "TranslationOption.h"#include "Util.h"#include "StaticData.h"#include "FactorTypeSet.h"/** Contains partial translation options, while these are constructed in the class TranslationOption. * The factored translation model allows for multiple translation and * generation steps during a single Hypothesis expansion. For efficiency, * all these expansions are precomputed and stored as TranslationOption. * The expansion process itself may be still explode, so efficient handling * of partial translation options during expansion is required. * This class assists in this tasks by implementing pruning. * This implementation is similar to the one in HypothesisStack. */class PartialTranslOptColl{ protected: std::vector<TranslationOption*> m_list; float m_bestScore; /**< score of the best translation option */ float m_worstScore; /**< score of the worse translation option */ size_t m_maxSize; /**< maximum number of translation options allowed */ size_t m_totalPruned; /**< number of options pruned */public: PartialTranslOptColl(); /** destructor, cleans out list */ ~PartialTranslOptColl() { RemoveAllInColl( m_list ); } void AddNoPrune(TranslationOption *partialTranslOpt); void Add(TranslationOption *partialTranslOpt); void Prune(); /** returns list of translation options */ const std::vector<TranslationOption*>& GetList() const { return m_list; } /** clear out the list */ void DetachAll() { m_list.clear(); } /** return number of pruned partial hypotheses */ size_t GetPrunedCount() { return m_totalPruned; } };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -