Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Germann <ugermann@inf.ed.ac.uk>2015-02-06 01:29:47 +0300
committerUlrich Germann <ugermann@inf.ed.ac.uk>2015-02-06 01:29:47 +0300
commit2073963e08a5d0fdf0d9d525610461f1d269f086 (patch)
tree2b7572c2832d017a0a6a12618fc95f8e809b3df3 /moses/TranslationOptionList.h
parentc1462fa87d69ba071a3b9ee21ce5726990e4d5a5 (diff)
Reformatting.
Diffstat (limited to 'moses/TranslationOptionList.h')
-rw-r--r--moses/TranslationOptionList.h115
1 files changed, 58 insertions, 57 deletions
diff --git a/moses/TranslationOptionList.h b/moses/TranslationOptionList.h
index 30b8f5675..fa205c26f 100644
--- a/moses/TranslationOptionList.h
+++ b/moses/TranslationOptionList.h
@@ -1,5 +1,5 @@
-#ifndef moses_TranslationOptionList_h
-#define moses_TranslationOptionList_h
+// -*- c++ -*-
+#pragma once
#include <vector>
#include "util/exception.hh"
@@ -9,62 +9,63 @@
namespace Moses
{
-class TranslationOption;
+ class TranslationOption;
-/** wrapper around vector of translation options
- */
-class TranslationOptionList
-{
- friend std::ostream& operator<<(std::ostream& out, const TranslationOptionList& coll);
-
-protected:
- typedef std::vector<TranslationOption*> CollType;
- CollType m_coll;
-
-public:
- typedef CollType::iterator iterator;
- typedef CollType::const_iterator const_iterator;
- const_iterator begin() const {
- return m_coll.begin();
- }
- const_iterator end() const {
- return m_coll.end();
- }
- iterator begin() {
- return m_coll.begin();
- }
- iterator end() {
- return m_coll.end();
- }
-
- TranslationOptionList() {
- }
- TranslationOptionList(const TranslationOptionList &copy);
- ~TranslationOptionList();
+ /** wrapper around vector of translation options
+ */
+ class TranslationOptionList
+ {
+ friend std::ostream& operator<<(std::ostream& out, const TranslationOptionList& coll);
- void resize(size_t newSize) {
- m_coll.resize(newSize);
- }
- size_t size() const {
- return m_coll.size();
- }
-
- const TranslationOption *Get(size_t ind) const {
- return m_coll.at(ind);
- }
- void Remove( size_t ind ) {
- UTIL_THROW_IF2(ind >= m_coll.size(),
- "Out of bound index " << ind);
- m_coll.erase( m_coll.begin()+ind );
- }
- void Add(TranslationOption *transOpt) {
- m_coll.push_back(transOpt);
- }
-
- TO_STRING();
-
-};
+ protected:
+ typedef std::vector<TranslationOption*> CollType;
+ CollType m_coll;
+
+ public:
+ typedef CollType::iterator iterator;
+ typedef CollType::const_iterator const_iterator;
+ const_iterator begin() const {
+ return m_coll.begin();
+ }
+ const_iterator end() const {
+ return m_coll.end();
+ }
+ iterator begin() {
+ return m_coll.begin();
+ }
+ iterator end() {
+ return m_coll.end();
+ }
+
+ TranslationOptionList() {
+ }
+ TranslationOptionList(const TranslationOptionList &copy);
+ ~TranslationOptionList();
+
+ void resize(size_t newSize) {
+ m_coll.resize(newSize);
+ }
+ size_t size() const {
+ return m_coll.size();
+ }
+
+ const TranslationOption *Get(size_t ind) const {
+ return m_coll.at(ind);
+ }
+ void Remove( size_t ind ) {
+ UTIL_THROW_IF2(ind >= m_coll.size(),
+ "Out of bound index " << ind);
+ m_coll.erase( m_coll.begin()+ind );
+ }
+ void Add(TranslationOption *transOpt) {
+ m_coll.push_back(transOpt);
+ }
+
+ size_t SelectNBest(size_t const N);
+ size_t PruneByThreshold(float const th);
+ TO_STRING();
+
+ };
+
}
-
-#endif