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:
Diffstat (limited to 'scripts/training/phrase-extract.6/TunnelCollection.cpp')
-rw-r--r--scripts/training/phrase-extract.6/TunnelCollection.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/scripts/training/phrase-extract.6/TunnelCollection.cpp b/scripts/training/phrase-extract.6/TunnelCollection.cpp
new file mode 100644
index 000000000..dfc21842d
--- /dev/null
+++ b/scripts/training/phrase-extract.6/TunnelCollection.cpp
@@ -0,0 +1,62 @@
+/*
+ * TunnelCollection.cpp
+ * extract
+ *
+ * Created by Hieu Hoang on 19/01/2010.
+ * Copyright 2010 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "TunnelCollection.h"
+
+using namespace std;
+
+size_t TunnelCollection::NumUnalignedWord(size_t direction, size_t startPos, size_t endPos) const
+{
+ assert(startPos <= endPos);
+
+ if (direction == 0)
+ assert(endPos < alignedCountS.size());
+ else
+ assert(endPos < alignedCountT.size());
+
+ size_t ret = 0;
+ for (size_t ind = startPos; ind <= endPos; ++ind)
+ {
+ if (direction == 0 && alignedCountS[ind] == 0)
+ {
+ ret++;
+ }
+ else if (direction == 1 && alignedCountT[ind] == 0)
+ {
+ ret++;
+ }
+
+ }
+
+ return ret;
+}
+
+std::ostream& operator<<(std::ostream &out, const TunnelCollection &TunnelCollection)
+{
+ size_t size = TunnelCollection.GetSize();
+
+ for (size_t startPos = 0; startPos < size; ++startPos)
+ {
+ for (size_t endPos = startPos; endPos < size; ++endPos)
+ {
+ const TunnelList &holeList = TunnelCollection.GetHoles(startPos, endPos);
+ TunnelList::const_iterator iter;
+ for (iter = holeList.begin(); iter != holeList.end(); ++iter)
+ {
+ const Tunnel &hole = *iter;
+ out << hole << " ";
+
+ }
+ }
+ }
+
+ return out;
+}
+
+