From f073c8e56914cf541bee86b6af4aaa2896a848c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20de=20Chalendar?= Date: Thu, 2 May 2024 11:45:24 +0200 Subject: [PATCH] Remove boost regex --- .../tools/evalCoref/evalCoref.cpp | 104 +++++++++--------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/lima_linguisticprocessing/tools/evalCoref/evalCoref.cpp b/lima_linguisticprocessing/tools/evalCoref/evalCoref.cpp index 3b70f28d8..18ff18600 100644 --- a/lima_linguisticprocessing/tools/evalCoref/evalCoref.cpp +++ b/lima_linguisticprocessing/tools/evalCoref/evalCoref.cpp @@ -295,57 +295,59 @@ void init(string csvFile, vector >*corefChains, NamedBoundsMap* BMap match_results what; while( getline(fin,line) ) { - string::const_iterator start = line.begin(); - string::const_iterator end = line.end(); - if (regex_search(start, end, what, expression)) - { - string id = string(what[1].first, what[1].second); - string ref = string(what[2].first, what[2].second); - string text = string(what[5].first, what[5].second); - bool definites = string(what[6].first, what[6].second)!="other" - && string(what[6].first, what[6].second)!="reflPron"; - float boundA = atoi(string(what[3].first, what[3].second).c_str()); - float boundB = atoi(string(what[4].first, what[4].second).c_str()); - BMap->insert(make_pair(id, make_pair(boundA, boundB))); - TMap->insert(make_pair(id, text)); - DMap->insert(make_pair(id, definites)); - - if (ref != "") - { - bool inserted = false; - for (vector >::iterator it = corefChains->begin(); it!=corefChains->end();it++) - { - if ((*it).find(ref)!=(*it).end()) - { - (*it).insert(id); - inserted = true; - break; - } - } - if (!inserted) - { - for (vector >::iterator it = corefChains->begin(); it!=corefChains->end();it++) - { - if ((*it).find(id)!=(*it).end()) - { - (*it).insert(ref); - inserted = true; - break; - } - } - } - if (!inserted) - { - corefChains->push_back(set()); - (*corefChains->rbegin()).insert(id); - (*corefChains->rbegin()).insert(ref); - } - } - } - else - { - std::cerr << "Error matching reference file line '"<insert(make_pair(id, make_pair(boundA, boundB))); + // TMap->insert(make_pair(id, text)); + // DMap->insert(make_pair(id, definites)); + // + // if (ref != "") + // { + // bool inserted = false; + // for (vector >::iterator it = corefChains->begin(); it!=corefChains->end();it++) + // { + // if ((*it).find(ref)!=(*it).end()) + // { + // (*it).insert(id); + // inserted = true; + // break; + // } + // } + // if (!inserted) + // { + // for (vector >::iterator it = corefChains->begin(); it!=corefChains->end();it++) + // { + // if ((*it).find(id)!=(*it).end()) + // { + // (*it).insert(ref); + // inserted = true; + // break; + // } + // } + // } + // if (!inserted) + // { + // corefChains->push_back(set()); + // (*corefChains->rbegin()).insert(id); + // (*corefChains->rbegin()).insert(ref); + // } + // } + // } + // else + // { + // std::cerr << "Error matching reference file line '"< >::iterator it1 = corefChains->begin(); it1!=corefChains->end();it1++) // {