Class: Iriq::Observation
- Inherits:
-
Object
- Object
- Iriq::Observation
- Defined in:
- lib/iriq/observation.rb
Overview
The result of Corpus#observe. Lightweight value object — heavy work (explanation, normalization) is deferred until you ask.
Instance Attribute Summary collapse
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #explanation ⇒ Object
- #fingerprint ⇒ Object
-
#initialize(corpus:, identifier:, cluster:) ⇒ Observation
constructor
A new instance of Observation.
- #normalize ⇒ Object
Constructor Details
#initialize(corpus:, identifier:, cluster:) ⇒ Observation
Returns a new instance of Observation.
7 8 9 10 11 |
# File 'lib/iriq/observation.rb', line 7 def initialize(corpus:, identifier:, cluster:) @corpus = corpus @identifier = identifier @cluster = cluster end |
Instance Attribute Details
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
5 6 7 |
# File 'lib/iriq/observation.rb', line 5 def cluster @cluster end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/iriq/observation.rb', line 5 def identifier @identifier end |
Instance Method Details
#explanation ⇒ Object
17 18 19 |
# File 'lib/iriq/observation.rb', line 17 def explanation @explanation ||= @corpus.explain(@identifier) end |
#fingerprint ⇒ Object
13 14 15 |
# File 'lib/iriq/observation.rb', line 13 def fingerprint @fingerprint ||= Normalizer.normalize_identifier(@identifier) end |
#normalize ⇒ Object
21 22 23 |
# File 'lib/iriq/observation.rb', line 21 def normalize @corpus.normalize(@identifier) end |