Class: Autotag::Extractor::Histogram
- Inherits:
-
Object
- Object
- Autotag::Extractor::Histogram
- Defined in:
- lib/autotag/extractor/document/histogram.rb
Instance Method Summary collapse
-
#initialize ⇒ Histogram
constructor
generate term histogram, stem histogram, both accessible by methods.
- #stem(stem) ⇒ Object
- #term(term) ⇒ Object
Constructor Details
#initialize ⇒ Histogram
generate term histogram, stem histogram, both accessible by methods
5 6 7 8 |
# File 'lib/autotag/extractor/document/histogram.rb', line 5 def initialize() @stems = {} @terms = {} end |
Instance Method Details
#stem(stem) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/autotag/extractor/document/histogram.rb', line 10 def stem(stem) if @stems[stem] @stems[stem] += 1 else @stems[stem] = 1 end end |
#term(term) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/autotag/extractor/document/histogram.rb', line 18 def term(term) if @terms[term] @terms[term] += 1 else @terms[term] = 1 end end |