Class: FactDb::Resolution::ResolvedEntity
- Inherits:
-
Object
- Object
- FactDb::Resolution::ResolvedEntity
- Defined in:
- lib/fact_db/resolution/entity_resolver.rb
Overview
Represents a resolved entity with confidence metadata
Wraps an entity with information about how it was resolved and the confidence level of the match.
Instance Attribute Summary collapse
-
#confidence ⇒ Float
readonly
Confidence score from 0.0 to 1.0.
-
#entity ⇒ FactDb::Models::Entity
readonly
The resolved entity.
-
#match_type ⇒ Symbol
readonly
How the entity was matched (:exact_alias, :name, :fuzzy).
Instance Method Summary collapse
-
#exact_match? ⇒ Boolean
Checks if this was an exact match (confidence == 1.0).
-
#fuzzy_match? ⇒ Boolean
Checks if this was a fuzzy match.
-
#id ⇒ Integer
Returns the entity ID.
-
#initialize(entity, confidence:, match_type:) ⇒ ResolvedEntity
constructor
Initializes a new ResolvedEntity.
-
#kind ⇒ String
Returns the entity kind.
-
#name ⇒ String
Returns the entity name.
Constructor Details
#initialize(entity, confidence:, match_type:) ⇒ ResolvedEntity
Initializes a new ResolvedEntity
319 320 321 322 323 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 319 def initialize(entity, confidence:, match_type:) @entity = entity @confidence = confidence @match_type = match_type end |
Instance Attribute Details
#confidence ⇒ Float (readonly)
Returns confidence score from 0.0 to 1.0.
309 310 311 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 309 def confidence @confidence end |
#entity ⇒ FactDb::Models::Entity (readonly)
Returns the resolved entity.
306 307 308 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 306 def entity @entity end |
#match_type ⇒ Symbol (readonly)
Returns how the entity was matched (:exact_alias, :name, :fuzzy).
312 313 314 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 312 def match_type @match_type end |
Instance Method Details
#exact_match? ⇒ Boolean
Checks if this was an exact match (confidence == 1.0)
328 329 330 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 328 def exact_match? confidence == 1.0 end |
#fuzzy_match? ⇒ Boolean
Checks if this was a fuzzy match
335 336 337 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 335 def fuzzy_match? match_type == :fuzzy end |
#id ⇒ Integer
Returns the entity ID
342 343 344 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 342 def id entity.id end |
#kind ⇒ String
Returns the entity kind
356 357 358 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 356 def kind entity.kind end |
#name ⇒ String
Returns the entity name
349 350 351 |
# File 'lib/fact_db/resolution/entity_resolver.rb', line 349 def name entity.name end |