00001
00002
00003
00004 #include <boost/program_options.hpp>
00005 #include <iomanip>
00006
00007 #include "tpt_typedefs.h"
00008 #include "ug_mm_ttrack.h"
00009 #include "ug_mm_tsa.h"
00010 #include "tpt_tokenindex.h"
00011 #include "ug_deptree.h"
00012 #include "ug_corpus_token.h"
00013
00014 using namespace Moses;
00015 using namespace std;
00016 using namespace boost;
00017 using namespace sapt;
00018 typedef L2R_Token < SimpleWordId > Token;
00019 int main(int argc, char* argv[])
00020 {
00021 using namespace std;
00022 if (argc < 3)
00023 {
00024 cerr << "usage: " << argv[0] << " <track base name> lookup word sequence"
00025 << endl;
00026 }
00027 string base = argv[1];
00028 TokenIndex V;
00029 V.open(base+".tdx");
00030 boost::shared_ptr<mmTtrack<Token> > T(new mmTtrack<Token>());
00031 T->open(base+".mct");
00032 mmTSA<Token> I; I.open(base+".sfa",T);
00033 mmTSA<Token>::tree_iterator m(&I);
00034
00035
00036 for (int i = 2; i < argc && m.extend(V[argv[i]]); ++i);
00037 if (int(m.size() + 2) < argc)
00038 {
00039 cerr << "NOT FOUND" << endl;
00040 exit(1);
00041 }
00042
00043 tsa::ArrayEntry e(m.lower_bound(-1));
00044 char const* stop = m.upper_bound(-1);
00045 do
00046 {
00047 m.root->readEntry(e.next,e);
00048 Token const* t = T->sntStart(e.sid) + e.offset;
00049 Token const* z = T->sntEnd(e.sid);
00050 for (;t != z; t = t->next()) cout << V[t->id()] << " ";
00051 cout << endl;
00052 } while (e.next != stop);
00053
00054 }