Skip to content

Commit

Permalink
moved cooc() to parent class
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Apr 25, 2012
1 parent dcdbcad commit 2523e67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion include/alignmodel.h
Expand Up @@ -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) {};
};

Expand Down Expand Up @@ -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);


Expand All @@ -95,6 +97,8 @@ class EMAlignmentModel: public AlignmentModel {
};




class EMAlignmentModel2: public AlignmentModel {
protected:
bool INIT;
Expand Down
4 changes: 2 additions & 2 deletions src/alignmodel.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 2523e67

Please sign in to comment.