Class: RerankerRuby::Result
- Inherits:
-
Object
- Object
- RerankerRuby::Result
- Defined in:
- lib/reranker_ruby/result.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(text:, score:, index:, metadata: {}) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ Object
Constructor Details
#initialize(text:, score:, index:, metadata: {}) ⇒ Result
Returns a new instance of Result.
7 8 9 10 11 12 |
# File 'lib/reranker_ruby/result.rb', line 7 def initialize(text:, score:, index:, metadata: {}) @text = text @score = score.to_f @index = index @metadata = end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
5 6 7 |
# File 'lib/reranker_ruby/result.rb', line 5 def index @index end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/reranker_ruby/result.rb', line 5 def @metadata end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
5 6 7 |
# File 'lib/reranker_ruby/result.rb', line 5 def score @score end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/reranker_ruby/result.rb', line 5 def text @text end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 |
# File 'lib/reranker_ruby/result.rb', line 18 def <=>(other) other.score <=> @score end |
#to_h ⇒ Object
14 15 16 |
# File 'lib/reranker_ruby/result.rb', line 14 def to_h { text: @text, score: @score, index: @index, metadata: @metadata } end |