|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _TERCPPTERCALC_H___ |
|
#define _TERCPPTERCALC_H___ |
|
|
|
#include <vector> |
|
#include <cstdio> |
|
#include <cstring> |
|
#include <sstream> |
|
#include "hashMap.h" |
|
#include "hashMapInfos.h" |
|
#include "hashMapStringInfos.h" |
|
#include "terAlignment.h" |
|
#include "tools.h" |
|
#include "terShift.h" |
|
#include "alignmentStruct.h" |
|
#include "bestShiftStruct.h" |
|
|
|
using namespace std; |
|
using namespace TERCPPNS_Tools; |
|
using namespace TERCPPNS_HashMapSpace; |
|
namespace TERCPPNS_TERCpp |
|
{ |
|
|
|
|
|
typedef vector<terShift> vecTerShift; |
|
|
|
|
|
|
|
class terCalc |
|
{ |
|
private : |
|
|
|
WERalignment l_WERalignment; |
|
|
|
hashMap bagOfWords; |
|
int TAILLE_PERMUT_MAX; |
|
int NBR_PERMUT_MAX; |
|
|
|
int NBR_SEGS_EVALUATED; |
|
int NBR_PERMUTS_CONSID; |
|
int NBR_BS_APPELS; |
|
int DIST_MAX_PERMUT; |
|
int CALL_TER_ALIGN; |
|
int CALL_CALC_PERMUT; |
|
int CALL_FIND_BSHIFT; |
|
int MAX_LENGTH_SENTENCE; |
|
bool PRINT_DEBUG; |
|
|
|
|
|
vector < vector < double > > * S; |
|
vector < vector < char > > * P; |
|
vector<vecInt> refSpans; |
|
vector<vecInt> hypSpans; |
|
int TAILLE_BEAM; |
|
|
|
public: |
|
int shift_cost; |
|
int insert_cost; |
|
int delete_cost; |
|
int substitute_cost; |
|
int match_cost; |
|
double infinite; |
|
terCalc(); |
|
|
|
~terCalc(); |
|
|
|
void setDebugMode ( bool b ); |
|
|
|
|
|
|
|
terAlignment WERCalculation ( vector< string >& hyp, vector< string >& ref ); |
|
|
|
|
|
hashMapInfos createConcordMots ( vector<string>& hyp, vector<string>& ref ); |
|
terAlignment minimizeDistanceEdition ( vector<string>& hyp, vector<string>& ref, vector<vecInt>& curHypSpans ); |
|
void minimizeDistanceEdition ( vector<string>& hyp, vector<string>& ref, vector<vecInt>& curHypSpans , terAlignment* l_terAlign); |
|
|
|
bool trouverIntersection ( vecInt& refSpan, vecInt& hypSpan ); |
|
terAlignment TER ( vector<string>& hyp, vector<string>& ref , float avRefLength ); |
|
terAlignment TER ( vector<string>& hyp, vector<string>& ref ); |
|
terAlignment TER ( vector<int>& hyp, vector<int>& ref ); |
|
bestShiftStruct * findBestShift ( vector< string >& cur, vector< string >& hyp, vector< string >& ref, hashMapInfos& rloc, TERCPPNS_TERCpp::terAlignment& med_align ); |
|
void calculateTerAlignment ( terAlignment& align, vector<bool>* herr, vector<bool>* rerr, vector<int>* ralign ); |
|
vector<vecTerShift> * calculerPermutations ( vector< string >& hyp, vector< string >& ref, hashMapInfos& rloc, TERCPPNS_TERCpp::terAlignment& align, vector<bool>* herr, vector<bool>* rerr, vector<int>* ralign ); |
|
alignmentStruct permuter ( vector<string>& words, terShift& s ); |
|
alignmentStruct permuter ( vector<string>& words, terShift* s ); |
|
alignmentStruct permuter ( vector<string>& words, int start, int end, int newloc ); |
|
}; |
|
|
|
} |
|
|
|
#endif |
|
|