Class: TextRank::FingerprintOverlap
- Inherits:
-
Object
- Object
- TextRank::FingerprintOverlap
- Defined in:
- lib/text_rank/fingerprint_overlap.rb
Overview
Determines "overlap" between two fingerprints at each N prefixes
For example,
FingerprintOverlap.new( %w[a b c d], %w[b e a c], ).overlap
=> [ 0, # [a] & (b) have no overlap 1, # [a b] & [b e] have one overlap: b 2, # [a b c] & [b e a] have two overlap: a & b 3, # [a b c d] & [b e a c] have three overlap: a, b, & c ]
Instance Attribute Summary collapse
-
#overlap ⇒ Object
readonly
Returns the value of attribute overlap.
Instance Method Summary collapse
-
#initialize(values1, values2) ⇒ FingerprintOverlap
constructor
A new instance of FingerprintOverlap.
Constructor Details
#initialize(values1, values2) ⇒ FingerprintOverlap
Returns a new instance of FingerprintOverlap.
23 24 25 26 27 28 29 30 31 |
# File 'lib/text_rank/fingerprint_overlap.rb', line 23 def initialize(values1, values2) raise ArgumentError, 'Value size mismatch' if values1.size != values2.size @encountered1 = Set.new @encountered2 = Set.new @overlap_count = 0 @overlap = determine_overlap(values1, values2) end |
Instance Attribute Details
#overlap ⇒ Object (readonly)
Returns the value of attribute overlap.
21 22 23 |
# File 'lib/text_rank/fingerprint_overlap.rb', line 21 def overlap @overlap end |