2014-06-12 21:30:41 +04:00
|
|
|
// (c) 2007,2008 Ulrich Germann
|
|
|
|
// Licensed to NRC-CNRC under special agreement.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Ulrich Germann
|
|
|
|
* @file tokenindex.dump.cc
|
|
|
|
* @brief Dumps a TokenIndex (vocab file for TPPT and TPLM) to stdout.
|
|
|
|
*/
|
|
|
|
|
2014-08-14 17:04:25 +04:00
|
|
|
#include "../mm/tpt_tokenindex.h"
|
2014-06-12 21:30:41 +04:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
using namespace std;
|
2016-02-18 19:39:34 +03:00
|
|
|
using namespace sapt;
|
2015-04-30 08:05:11 +03:00
|
|
|
int
|
2014-06-12 21:30:41 +04:00
|
|
|
main(int argc,char* argv[])
|
|
|
|
{
|
|
|
|
if (argc > 1 && !strcmp(argv[1], "-h")) {
|
|
|
|
printf("Usage: %s <file>\n\n", argv[0]);
|
|
|
|
cout << "Converts a phrase table in text format to a phrase table in tighly packed format." << endl;
|
|
|
|
cout << "input file: token index file" << endl;
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
TokenIndex I;
|
|
|
|
I.open(argv[1]);
|
|
|
|
vector<char const*> foo = I.reverseIndex();
|
|
|
|
for (size_t i = 0; i < foo.size(); i++)
|
|
|
|
cout << setw(10) << i << " " << foo[i] << endl;
|
|
|
|
}
|