00001 #include "_SuffixArrayScanningBase.h"
00002 #include "stdio.h"
00003 #include "stdlib.h"
00004 #include <iostream>
00005 #include <fstream>
00006 #include <map>
00007
00008 using namespace std;
00009
00023 int main(int argc, char * argv[]){
00024
00025
00026
00027 if(argc<3){
00028 fprintf(stderr,"\nUsage:\n");
00029 fprintf(stderr,"\n%s fileNameStem cfgFile\n\n",argv[0]);
00030
00031 fprintf(stderr,"\n\tCfgFile Format:");
00032 fprintf(stderr,"\n\t\tn1<tab>freq thresh for output n1-gram");
00033 fprintf(stderr,"\n\t\tn2<tab>freq thresh for output n2-gram");
00034 fprintf(stderr,"\n\t\t... ... ...");
00035 fprintf(stderr,"\n\t\tn1<tab>freq thresh for output n1-gram\n");
00036
00037
00038 exit(0);
00039 }
00040
00041
00042 map<int, unsigned int> threshMap;
00043 map<int, unsigned int>::iterator iterThreshMap;
00044 fstream threshFile;
00045 threshFile.open(argv[2]);
00046 int n;
00047 int maxN = 0;
00048 unsigned int thresh;
00049 while(! threshFile.eof()){
00050 threshFile>>n>>thresh;
00051 if(n>maxN){
00052 maxN=n;
00053 }
00054 iterThreshMap = threshMap.find(n);
00055 if(iterThreshMap==threshMap.end()){
00056 threshMap.insert(make_pair(n,thresh));
00057 }
00058 }
00059
00060 C_SuffixArrayScanningBase saObj(argv[1], maxN);
00061 iterThreshMap = threshMap.begin();
00062 while(iterThreshMap!=threshMap.end()){
00063 saObj.setNgramOutputFreqThresh(iterThreshMap->first, iterThreshMap->second);
00064 iterThreshMap++;
00065 }
00066
00067 saObj.scanSuffixArrayForHighFreqNgramType();
00068
00069 return 1;
00070 }