00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __TERCPPTOOLS_H__
00022 #define __TERCPPTOOLS_H__
00023
00024
00025 #include <vector>
00026 #include <iostream>
00027 #include <cstdio>
00028 #include <cstdlib>
00029 #include <string>
00030 #include <sstream>
00031 #include <boost/xpressive/xpressive.hpp>
00032
00033
00034 using namespace std;
00035
00036 namespace TERCPPNS_Tools
00037 {
00038 typedef vector<double> vecDouble;
00039 typedef vector<char> vecChar;
00040 typedef vector<int> vecInt;
00041 typedef vector<float> vecFloat;
00042 typedef vector<size_t> vecSize_t;
00043 typedef vector<string> vecString;
00044 typedef vector<string> alignmentElement;
00045 typedef vector<alignmentElement> WERalignment;
00046
00047
00048 struct param {
00049 bool debugMode;
00050 string referenceFile;
00051 string hypothesisFile;
00052 string outputFileExtension;
00053 string outputFileName;
00054 bool noPunct;
00055 bool caseOn;
00056 bool normalize;
00057 bool tercomLike;
00058 bool sgmlInputs;
00059 bool verbose;
00060 bool count_verbose;
00061 bool noTxtIds;
00062 bool printAlignments;
00063 bool WER;
00064 int debugLevel;
00065 };
00066
00067
00068
00069
00070
00071
00072 string vectorToString ( vector<string> vec );
00073 string vectorToString ( vector<char> vec );
00074 string vectorToString ( vector<int> vec );
00075 string vectorToString ( vector<string> vec, string s );
00076 string vectorToString ( vector<char> vec, string s );
00077 string vectorToString ( vector<int> vec, string s );
00078 string vectorToString ( vector<bool> vec, string s );
00079 string vectorToString ( char* vec, string s, int taille );
00080 string vectorToString ( int* vec, string s , int taille );
00081 string vectorToString ( bool* vec, string s , int taille );
00082 string vectorToString ( vector<char>* vec, string s, int taille );
00083 string vectorToString ( vector<int>* vec, string s , int taille );
00084 string vectorToString ( vector<bool>* vec, string s , int taille );
00085 vector<string> subVector ( vector<string> vec, int start, int end );
00086 vector<int> subVector ( vector<int> vec, int start, int end );
00087 vector<float> subVector ( vector<float> vec, int start, int end );
00088 vector<string> copyVector ( vector<string> vec );
00089 vector<int> copyVector ( vector<int> vec );
00090 vector<float> copyVector ( vector<float> vec );
00091 vector<string> stringToVector ( string s, string tok );
00092 vector<string> stringToVector ( char s, string tok );
00093 vector<string> stringToVector ( int s, string tok );
00094 vector<int> stringToVectorInt ( string s, string tok );
00095 vector<float> stringToVectorFloat ( string s, string tok );
00096 string lowerCase(string str);
00097 string removePunct(string str);
00098 string tokenizePunct(string str);
00099 string removePunctTercom(string str);
00100 string normalizeStd(string str);
00101 string printParams(param p);
00102 string join ( string delim, vector<string> arr );
00103
00104 param copyParam(param p);
00105 }
00106 #endif