summaryrefslogtreecommitdiff
path: root/extractor/sampler.h
diff options
context:
space:
mode:
Diffstat (limited to 'extractor/sampler.h')
-rw-r--r--extractor/sampler.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/extractor/sampler.h b/extractor/sampler.h
index cda28b10..be4aa1bb 100644
--- a/extractor/sampler.h
+++ b/extractor/sampler.h
@@ -10,18 +10,23 @@ namespace extractor {
class PhraseLocation;
class SuffixArray;
+/**
+ * Provides uniform sampling for a PhraseLocation.
+ */
class Sampler {
public:
Sampler(shared_ptr<SuffixArray> suffix_array, int max_samples);
virtual ~Sampler();
+ // Samples uniformly at most max_samples phrase occurrences.
virtual PhraseLocation Sample(const PhraseLocation& location) const;
protected:
Sampler();
private:
+ // Round floating point number to the nearest integer.
int Round(double x) const;
shared_ptr<SuffixArray> suffix_array;