00001 #include "moses/TranslationModel/UG/mm/ug_mm_ttrack.h"
00002 #include "moses/TranslationModel/UG/mm/ug_mm_tsa.h"
00003 #include "moses/TranslationModel/UG/mm/tpt_tokenindex.h"
00004 #include "moses/TranslationModel/UG/mm/ug_corpus_token.h"
00005 #include "moses/TranslationModel/UG/mm/ug_typedefs.h"
00006 #include "moses/TranslationModel/UG/mm/tpt_pickler.h"
00007 #include "moses/TranslationModel/UG/mm/ug_bitext.h"
00008 #include "moses/TranslationModel/UG/mm/ug_lexical_phrase_scorer2.h"
00009
00010 #include "moses/TranslationModel/UG/generic/file_io/ug_stream.h"
00011
00012
00013 using namespace ugdiss;
00014 using namespace sapt;
00015 using namespace std;
00016
00017 typedef L2R_Token<SimpleWordId> Token;
00018 TokenIndex V;
00019 SPTR<vector<vector<Token> > > C(new vector<vector<Token> >());
00020 void
00021 add_file(string fname)
00022 {
00023 boost::iostreams::filtering_istream in;
00024 open_input_stream(fname,in);
00025 string line;
00026 while (getline(in,line))
00027 {
00028 C->push_back(vector<Token>());
00029 fill_token_seq(V,line,C->back());
00030 }
00031 }
00032
00033 int
00034 main(int argc, char* argv[])
00035 {
00036 V.setDynamic(true);
00037 add_file(argv[1]);
00038 SPTR<imTtrack<Token> > T(new imTtrack<Token>(C));
00039 imTSA<Token> I(T,NULL,NULL);
00040 string line;
00041 while (getline(cin,line))
00042 {
00043 vector<Token> seq; fill_token_seq<Token>(V,line,seq);
00044 for (size_t i = 0; i < seq.size(); ++i)
00045 {
00046 TSA<Token>::tree_iterator m(&I);
00047 cout << V[seq[i].id()];
00048 for (size_t k = i; k < seq.size() && m.extend(seq[k]); ++k)
00049 {
00050 cout << " ";
00051 if (k > i) cout << V[seq[k].id()] << " ";
00052 cout << "[" << m.approxOccurrenceCount() << "]";
00053 }
00054 cout << endl;
00055 }
00056 }
00057 }