Commit c32b8a2b authored by David Geisler's avatar David Geisler

rehash implemented

parent 73e65017
......@@ -94,7 +94,7 @@ namespace utue::pe::tools::lsh {
/**
* Creates an empty dictionary
*/
Dictionary();
Dictionary(const unsigned int& buckets);
/**
*
......
......@@ -86,7 +86,7 @@ namespace utue::pe::tools::lsh {
* @param dictionary The related dictionary
* @param scanner Scanner to extract Tokens from text
*/
Document(DictionaryPtr dictionary, ScannerPtr scanner);
Document(DictionaryPtr dictionary, ScannerPtr scanner, const unsigned int& buckets);
/**
* Add a Token to the Document
......
Subproject commit 61473b5cd5cd992d656639408fab1d45feb2a084
Subproject commit 6f87d658c8d5a348f61eba50165858b03fbe60dd
......@@ -56,8 +56,8 @@
namespace utue::pe::tools::lsh {
Dictionary::Dictionary() :
m_tokens(), m_count(0), m_max(0) {
Dictionary::Dictionary(const unsigned int& buckets) :
m_tokens(buckets), m_count(0), m_max(0) {
}
......
......@@ -59,8 +59,8 @@
namespace utue::pe::tools::lsh {
Document::Document(DictionaryPtr dictionary, ScannerPtr scanner) :
Dictionary(),
Document::Document(DictionaryPtr dictionary, ScannerPtr scanner, const unsigned int& buckets) :
Dictionary(buckets),
m_dictionary(std::move(dictionary)),
m_scanner(std::move(scanner)) {
......
......@@ -201,7 +201,9 @@ namespace utue::pe::tools::lsh {
private:
MinHash* m_instance;
public:
explicit MinHashDictionary(MinHash* instance) : m_instance(instance) {}
explicit MinHashDictionary(MinHash* instance, const unsigned int& buckets) :
Dictionary(buckets),
m_instance(instance) {}
void add(const Token& token) override {
Dictionary::add(token);
......@@ -227,7 +229,7 @@ namespace utue::pe::tools::lsh {
};
MinHash::MinHash(const unsigned int& hashes, const unsigned int& buckets) :
m_dictionary(new MinHashDictionary(this)),
m_dictionary(new MinHashDictionary(this,buckets)),
m_scanner(new MinHashScanner()),
m_permutations(),
m_hashes(hashes),
......@@ -238,7 +240,7 @@ namespace utue::pe::tools::lsh {
}
DocumentPtr MinHash::createDocument() {
return std::make_shared<Document>(this->m_dictionary,this->m_scanner);
return std::make_shared<Document>(this->m_dictionary,this->m_scanner,this->m_buckets);
}
DocumentPtr MinHash::createDocument(const std::string& text) {
......
......@@ -107,12 +107,12 @@ namespace utue::pe::tools::lsh {
};
SubsMatch::SubsMatch() :
m_dictionary(new Dictionary()),
m_dictionary(new Dictionary(1024)),
m_scanner(new SubsMatchScanner()) {
}
DocumentPtr SubsMatch::createDocument() {
return std::make_shared<Document>(this->m_dictionary,this->m_scanner);
return std::make_shared<Document>(this->m_dictionary,this->m_scanner,1024);
}
DocumentPtr SubsMatch::createDocument(const std::string& text) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment