2014-03-11 14:32:10 +01:00
|
|
|
#ifndef TM_MATCHES_HDR
|
|
|
|
#define TM_MATCHES_HDR
|
|
|
|
|
|
|
|
#include <string>
|
2015-04-15 10:55:26 +02:00
|
|
|
#include <vector>
|
2015-04-15 11:50:59 +02:00
|
|
|
#include <map>
|
2014-03-11 14:32:10 +01:00
|
|
|
#include "concordia/common/config.hpp"
|
|
|
|
#include "concordia/interval.hpp"
|
2015-04-14 20:14:30 +02:00
|
|
|
#include <boost/ptr_container/ptr_map.hpp>
|
2014-03-11 14:32:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Class used within Anubis search algorithm to store partial results.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class TmMatches {
|
|
|
|
public:
|
2015-04-15 11:50:59 +02:00
|
|
|
TmMatches();
|
|
|
|
|
|
|
|
TmMatches(const SUFFIX_MARKER_TYPE exampleId,
|
|
|
|
const SUFFIX_MARKER_TYPE exampleSize,
|
|
|
|
const SUFFIX_MARKER_TYPE patternSize);
|
2014-03-11 14:32:10 +01:00
|
|
|
|
|
|
|
/*! Destructor.
|
|
|
|
*/
|
|
|
|
virtual ~TmMatches();
|
|
|
|
|
|
|
|
double getScore() const {
|
|
|
|
return _score;
|
|
|
|
}
|
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
vector<Interval> getExampleIntervals() const {
|
2015-04-14 20:14:30 +02:00
|
|
|
return _exampleMatchedRegions;
|
|
|
|
}
|
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
vector<Interval> getPatternIntervals() const {
|
2015-04-14 20:14:30 +02:00
|
|
|
return _patternMatchedRegions;
|
|
|
|
}
|
|
|
|
|
2014-03-11 14:32:10 +01:00
|
|
|
SUFFIX_MARKER_TYPE getExampleId() const {
|
|
|
|
return _exampleId;
|
|
|
|
}
|
2014-04-29 14:46:04 +02:00
|
|
|
|
2014-03-11 14:32:10 +01:00
|
|
|
void calculateSimpleScore();
|
2014-04-29 14:46:04 +02:00
|
|
|
|
2014-03-11 14:32:10 +01:00
|
|
|
void calculateScore();
|
|
|
|
|
|
|
|
void addExampleInterval(int start, int end);
|
|
|
|
|
|
|
|
void addPatternInterval(int start, int end);
|
2014-04-29 14:46:04 +02:00
|
|
|
|
2014-03-11 14:32:10 +01:00
|
|
|
private:
|
2015-04-15 10:55:26 +02:00
|
|
|
bool _alreadyIntersects(const vector<Interval> & intervalList,
|
|
|
|
int start, int end);
|
2014-04-29 14:46:04 +02:00
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
double _getLogarithmicOverlay(const vector<Interval> & intervalList,
|
2015-04-15 11:50:59 +02:00
|
|
|
SUFFIX_MARKER_TYPE sentenceSize,
|
2015-04-15 10:55:26 +02:00
|
|
|
double k);
|
2014-03-11 14:32:10 +01:00
|
|
|
|
2014-04-29 14:46:04 +02:00
|
|
|
SUFFIX_MARKER_TYPE _exampleId;
|
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
vector<Interval> _exampleMatchedRegions;
|
2014-03-11 14:32:10 +01:00
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
vector<Interval> _patternMatchedRegions;
|
2014-03-11 14:32:10 +01:00
|
|
|
|
2015-04-15 11:50:59 +02:00
|
|
|
SUFFIX_MARKER_TYPE _patternSize;
|
2014-03-11 14:32:10 +01:00
|
|
|
|
2015-04-15 11:50:59 +02:00
|
|
|
SUFFIX_MARKER_TYPE _exampleSize;
|
2014-03-11 14:32:10 +01:00
|
|
|
|
2014-04-29 14:46:04 +02:00
|
|
|
double _score;
|
2014-03-11 14:32:10 +01:00
|
|
|
};
|
|
|
|
|
2015-04-14 20:14:30 +02:00
|
|
|
typedef boost::ptr_map<SUFFIX_MARKER_TYPE, TmMatches> TmMatchesMap;
|
|
|
|
typedef TmMatchesMap::iterator TmMatchesMapIterator;
|
|
|
|
|
2014-03-11 14:32:10 +01:00
|
|
|
#endif
|