Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Fix bugs so that docsim-compare works with a keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
zimeon committed Aug 5, 2014
1 parent baaf81a commit aa7311c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cpp/lib/KeyMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ KeyMap::~KeyMap(void)
//
void KeyMap::getCommonDocs(DocPairVector& dpv, int n, docid id2)
{
cout << "getCommonDocs: called on keymap with " << size() << " ids" << endl;
cout << "getCommonDocs: called on keymap with " << size() << " keys, threshold=" << n << endl;
// Find largest docid
docid maxDocid=0;
for (KeyMap::iterator kit=begin(); kit!=end(); kit++) {
// kit->second is KgramInfo object, has ids[0..idsSize]
KgramInfo* ki=kit->second;
for (int j=0; j<(ki->idsSize); j++) {
for (int j=0; j<(ki->size()); j++) {
if (ki->ids[j]>maxDocid) maxDocid=ki->ids[j];
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ void filterKeymap(keymap& ks, keymap& kf, keymap& kr)
if (ksit!=ks.end()) {
// This kgram is in both maps
//cout << "ksit: " << *ksit->second << endl;
KgramInfo* kip=new KgramInfo(*ksit->second);
KgramInfo* kip=new KgramInfo(ksit->second);
//cout << kip << endl;
kr.insert(keymap::value_type(ksit->first,kip));
}
Expand Down
5 changes: 0 additions & 5 deletions cpp/lib/KeyMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,13 @@ ostream& operator<<(ostream& out, keymap& keys);
istream& operator>>(istream& in, keymap& keys);
void eraseKeymap(keymap& keys);
void filterKeymap(keymap& ks, keymap& kf, keymap& kr);
//void getCommonDocs(keymap& keys, DocPairVector& dpv, int n, docid id2=9999999);

class KeyMap: public keymap {
public:
// METHODS
KeyMap(void);
~KeyMap(void);
void getCommonDocs(DocPairVector& dpv, int n, docid id2=9999999);

};

//was necessary (?) by now (2014-08) causes recursive call on RHEL6
//inline void filterKeymap(KeyMap& ks, KeyMap& kf, KeyMap& kr) { filterKeymap(ks,kf,kr); }

#endif /* #ifndef __INC_KeyMap */

0 comments on commit aa7311c

Please sign in to comment.