Commit a4c95c09 authored by David Geisler's avatar David Geisler

propagate utils changes

parent 2df574cb
......@@ -231,7 +231,7 @@ namespace utue::pe::tools::lsh {
* @param hashes Number of different hash functions resulting in different permutations.
* @param buckets Number of buckets in the chained hash set of Tokens
*/
explicit MinHash(const unsigned int& hashes, const unsigned int& buckets = 500);
MinHash(const unsigned int& hashes = 100, const unsigned int& buckets = 500);
/**
* Creates a new document
......@@ -275,7 +275,7 @@ namespace utue::pe::tools::lsh {
* Calculates the similarity of to Documents
* @param similarity Read/Write container with two documents
*/
void similarity(Similarity& similarity);
void similarity(Similarity& similarity) const;
/**
* Calculates the similarity of to Documents
......@@ -285,7 +285,7 @@ namespace utue::pe::tools::lsh {
* @param seed Random number generator seed
* @return Similarity of two Documents
*/
[[nodiscard]] Similarity similarity(const DocumentPtr& left, const DocumentPtr& right, const unsigned int& thresholds = 10, const unsigned int& seed = 0);
[[nodiscard]] Similarity similarity(const DocumentPtr& left, const DocumentPtr& right, const unsigned int& thresholds = 10, const unsigned int& seed = 0) const;
/**
* Calculates the similarity of to string
......
......@@ -164,7 +164,7 @@ namespace utue::pe::tools::lsh {
* Calculates the similarity of to Documents
* @param similarity Read/Write container with two documents
*/
void similarity(Similarity& similarity);
void similarity(Similarity& similarity) const;
/**
* Calculates the similarity of to Documents
......@@ -172,7 +172,7 @@ namespace utue::pe::tools::lsh {
* @param right The second Document
* @return Similarity of two Documents
*/
[[nodiscard]] Similarity similarity(const DocumentPtr& left, const DocumentPtr& right);
[[nodiscard]] Similarity similarity(const DocumentPtr& left, const DocumentPtr& right) const;
/**
* Calculates the similarity of to string
......
Subproject commit 54c896d649f71b2613cb2ff252a46b567f214540
Subproject commit 69f6204673e5f42acf45298d47ca55d7618b5a8c
......@@ -254,7 +254,7 @@ namespace utue::pe::tools::lsh {
permutation.insert(token);
}
void MinHash::similarity(Similarity& similarity) {
void MinHash::similarity(Similarity& similarity) const {
Similarity::ReportEntry entry;
utils::Tic tic;
......@@ -337,7 +337,7 @@ namespace utue::pe::tools::lsh {
similarity.m_seconds = utils::Toc(tic).seconds();
}
MinHash::Similarity MinHash::similarity(const DocumentPtr& left, const DocumentPtr& right, const unsigned int& thresholds, const unsigned int& seed) {
MinHash::Similarity MinHash::similarity(const DocumentPtr& left, const DocumentPtr& right, const unsigned int& thresholds, const unsigned int& seed) const {
Similarity similarity(left,right,thresholds,seed,this->m_hashes,this->m_buckets);
this->similarity(similarity);
return similarity;
......
......@@ -63,6 +63,7 @@
#include <sstream>
#include <iomanip>
namespace utue::pe::tools::lsh {
SubsMatch::Similarity::Similarity(DocumentPtr left, DocumentPtr right) :
......@@ -122,7 +123,7 @@ namespace utue::pe::tools::lsh {
return doc;
}
void SubsMatch::similarity(Similarity& similarity) {
void SubsMatch::similarity(Similarity& similarity) const {
utils::Tic tic;
unsigned int leftFreq;
unsigned int rightFreq;
......@@ -156,7 +157,7 @@ namespace utue::pe::tools::lsh {
similarity.m_seconds = utils::Toc(tic).seconds();
}
SubsMatch::Similarity SubsMatch::similarity(const DocumentPtr& left, const DocumentPtr& right) {
SubsMatch::Similarity SubsMatch::similarity(const DocumentPtr& left, const DocumentPtr& right) const {
Similarity similarity(left,right);
this->similarity(similarity);
return similarity;
......@@ -178,4 +179,4 @@ namespace utue::pe::tools::lsh {
return std::make_shared<SubsMatch>();
}
}
\ No newline at end of file
}
......@@ -97,7 +97,7 @@ int main(int argc, const char** argv) {
exit(EXIT_FAILURE); // fail
}
// create a new SubsMatch instance
// create a new LshSimilarity instance
subsMatch = SubsMatch::create();
// add scanners to tokenize the strings into ngrams
......
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