Permalink
Browse files

moved cooc() to parent class

  • Loading branch information...
1 parent dcdbcad commit 2523e67aec85cfa2d283e058e873888e80714d55 @proycon committed Apr 25, 2012
Showing with 7 additions and 3 deletions.
  1. +5 −1 include/alignmodel.h
  2. +2 −2 src/alignmodel.cpp
View
6 include/alignmodel.h
@@ -41,6 +41,8 @@ class AlignmentModel: public AlignConstraintInterface {
int graphalign(SelectivePatternModel & sourcemodel, SelectivePatternModel & targetmodel, double impactfactor = 1.2);
+ double cooc( CoocMode mode, const std::multiset<uint32_t> & sourceindex, const std::multiset<uint32_t> & targetindex, const double threshold = 0); //multiset instead of vector cause we want the ordering to easily compute co-occurence
+
virtual void save(const std::string & filename) {};
};
@@ -73,7 +75,7 @@ class CoocAlignmentModel: public AlignmentModel {
void save(const std::string & filename);
- double cooc( const std::multiset<uint32_t> & sourceindex, const std::multiset<uint32_t> & targetindex, const double threshold = 0); //multiset instead of vector cause we want the ordering to easily compute co-occurence
+
unsigned int compute(const EncAnyGram * sourcegram, const std::multiset<uint32_t> & sourceindex, SelectivePatternModel * targetmodel);
@@ -95,6 +97,8 @@ class EMAlignmentModel: public AlignmentModel {
};
+
+
class EMAlignmentModel2: public AlignmentModel {
protected:
bool INIT;
View
4 src/alignmodel.cpp
@@ -4,7 +4,7 @@ using namespace std;
const EncNullGram * NULLGRAM = new EncNullGram();
-double CoocAlignmentModel::cooc( const multiset<uint32_t> & sourceindex, const multiset<uint32_t> & targetindex, const double heurthreshold) {
+double AlignmentModel::cooc( CoocMode mode, const multiset<uint32_t> & sourceindex, const multiset<uint32_t> & targetindex, const double heurthreshold) {
//Jaccard co-occurrence
int intersectioncount = 0;
@@ -82,7 +82,7 @@ unsigned int CoocAlignmentModel::compute(const EncAnyGram * sourcegram, const mu
} else {
targetindex = &targetmodel->skipgrams[*( (EncSkipGram*) targetgram)].sentences;
}
- const double coocvalue = cooc(sourceindex, *targetindex, absthreshold);
+ const double coocvalue = cooc(mode, sourceindex, *targetindex, absthreshold);
if (coocvalue >= absthreshold) {
//prune based on absolute co-occurrence value
found++;

0 comments on commit 2523e67

Please sign in to comment.