diff options
author | Barry Haddow <barry.haddow@gmail.com> | 2011-11-23 19:48:48 +0400 |
---|---|---|
committer | Barry Haddow <barry.haddow@gmail.com> | 2011-11-23 19:48:48 +0400 |
commit | 9c952b586f98fe9c1c7b976a871b2f9e1c33f1c6 (patch) | |
tree | aae21e6e61debdb5aac3c8f2e16f2730aa927580 /moses-cmd | |
parent | 66c29e01c42ce48b77f62e4100c77f5f7701dcc5 (diff) |
move checkplf
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/src/Jamfile | 3 | ||||
-rw-r--r-- | moses-cmd/src/Makefile.am | 5 | ||||
-rw-r--r-- | moses-cmd/src/checkplf.cpp | 62 |
3 files changed, 2 insertions, 68 deletions
diff --git a/moses-cmd/src/Jamfile b/moses-cmd/src/Jamfile index 19ef91e8f..e08befa48 100644 --- a/moses-cmd/src/Jamfile +++ b/moses-cmd/src/Jamfile @@ -1,9 +1,8 @@ alias deps : ../../moses/src//moses ../../OnDiskPt/src//OnDiskPt ; -exe checkplf : checkplf.cpp deps ; exe moses : Main.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp LatticeMBR.cpp deps ; exe lmbrgrid : LatticeMBRGrid.cpp LatticeMBR.cpp IOWrapper.cpp deps ; -alias programs : checkplf moses lmbrgrid ; +alias programs : moses lmbrgrid ; install legacy-install : programs : <location>. <install-type>EXE <install-dependencies>on <link>shared:<dll-path>$(TOP)/moses-cmd/src <link>shared:<install-type>LIB ; diff --git a/moses-cmd/src/Makefile.am b/moses-cmd/src/Makefile.am index 055277ce4..11b2084ca 100644 --- a/moses-cmd/src/Makefile.am +++ b/moses-cmd/src/Makefile.am @@ -1,10 +1,7 @@ -bin_PROGRAMS = moses lmbrgrid checkplf +bin_PROGRAMS = moses lmbrgrid AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS) -checkplf_SOURCES = checkplf.cpp -checkplf_LDADD = $(top_builddir)/moses/src/libmoses.la -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt $(top_srcdir)/util/libkenutil.la $(top_srcdir)/lm/libkenlm.la $(BOOST_THREAD_LDFLAGS) $(BOOST_THREAD_LIBS) - moses_SOURCES = Main.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp LatticeMBR.cpp moses_LDADD = $(top_builddir)/moses/src/libmoses.la -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt $(top_srcdir)/util/libkenutil.la $(top_srcdir)/lm/libkenlm.la $(BOOST_THREAD_LDFLAGS) $(BOOST_THREAD_LIBS) diff --git a/moses-cmd/src/checkplf.cpp b/moses-cmd/src/checkplf.cpp deleted file mode 100644 index f8de29e8e..000000000 --- a/moses-cmd/src/checkplf.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include <iostream> - -#include "PCNTools.h" - -using namespace std; - -int main() -{ - cerr << "Reading PLF from STDIN...\n"; - string line; - int lc = 0; - double num_paths = 0; - double num_nodes = 0; - double num_edges = 0; - while(cin) { - getline(cin,line); - if (line.empty()) continue; - ++lc; - PCN::CN plf = PCN::parsePCN(line); - vector<double> alphas(plf.size() + 1, 0.0); - num_nodes += plf.size(); - alphas[0] = 1.0; - for (unsigned node = 0; node < plf.size(); ++node) { - const PCN::CNCol& edges = plf[node]; - const double alpha = alphas[node]; - if (alpha < 1.0) { - cerr << "Line " << lc << ": unreachable node at column position " << (node+1) << endl; - return 1; - } - num_edges += edges.size(); - for (unsigned j = 0; j < edges.size(); ++j) { - const PCN::CNAlt& edge = edges[j]; - size_t head = edge.second + node; - const string& label = edge.first.first; - if (head <= node) { - cerr << "Line " << lc << ": cycle detected at column position " << (node+1) << ", edge label = '" << label << "'" << endl; - return 1; - } - if (head >= alphas.size()) { - cerr << "Line " << lc << ": edge goes beyond goal node at column position " << (node+1) << ", edge label = '" << label << "'" << endl; - cerr << " Goal node expected at position " << alphas.size() << ", but edge references a node at position " << head << endl; - return 1; - } - alphas[head] += alpha; - } - } - if (alphas.back() < 1.0) { - cerr << "Line " << lc << ": there appears to be no path to the goal" << endl; - return 1; - } - num_paths += alphas.back(); - } - cerr << "PLF format appears to be correct.\nSTATISTICS:\n"; - cerr << " Number of lattices: " << lc << endl; - cerr << " Total number of nodes: " << num_nodes << endl; - cerr << " Total number of edges: " << num_edges << endl; - cerr << " Average density: " << (num_edges / num_nodes) << " edges/node\n"; - cerr << " Total number of paths: " << num_paths << endl; - cerr << " Average number of paths: " << (num_paths / lc) << endl; - return 0; -} - |