Class: Kreuzberg::Config::Keywords
- Inherits:
-
Object
- Object
- Kreuzberg::Config::Keywords
- Defined in:
- lib/kreuzberg/config.rb
Overview
Keyword extraction configuration for document analysis
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
readonly
Returns the value of attribute algorithm.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#max_keywords ⇒ Object
readonly
Returns the value of attribute max_keywords.
-
#min_score ⇒ Object
readonly
Returns the value of attribute min_score.
-
#ngram_range ⇒ Object
readonly
Returns the value of attribute ngram_range.
-
#rake_params ⇒ Object
readonly
Returns the value of attribute rake_params.
-
#yake_params ⇒ Object
readonly
Returns the value of attribute yake_params.
Instance Method Summary collapse
-
#initialize(algorithm: nil, max_keywords: nil, min_score: nil, ngram_range: nil, language: nil, yake_params: nil, rake_params: nil) ⇒ Keywords
constructor
A new instance of Keywords.
- #to_h ⇒ Object
Constructor Details
#initialize(algorithm: nil, max_keywords: nil, min_score: nil, ngram_range: nil, language: nil, yake_params: nil, rake_params: nil) ⇒ Keywords
Returns a new instance of Keywords.
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
# File 'lib/kreuzberg/config.rb', line 685 def initialize( algorithm: nil, max_keywords: nil, min_score: nil, ngram_range: nil, language: nil, yake_params: nil, rake_params: nil ) @algorithm = algorithm&.to_s @max_keywords = max_keywords&.to_i @min_score = min_score&.to_f @ngram_range = ngram_range&.map(&:to_i) @language = language&.to_s @yake_params = normalize_nested(yake_params, KeywordYakeParams) @rake_params = normalize_nested(rake_params, KeywordRakeParams) end |
Instance Attribute Details
#algorithm ⇒ Object (readonly)
Returns the value of attribute algorithm.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def algorithm @algorithm end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def language @language end |
#max_keywords ⇒ Object (readonly)
Returns the value of attribute max_keywords.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def max_keywords @max_keywords end |
#min_score ⇒ Object (readonly)
Returns the value of attribute min_score.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def min_score @min_score end |
#ngram_range ⇒ Object (readonly)
Returns the value of attribute ngram_range.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def ngram_range @ngram_range end |
#rake_params ⇒ Object (readonly)
Returns the value of attribute rake_params.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def rake_params @rake_params end |
#yake_params ⇒ Object (readonly)
Returns the value of attribute yake_params.
682 683 684 |
# File 'lib/kreuzberg/config.rb', line 682 def yake_params @yake_params end |
Instance Method Details
#to_h ⇒ Object
703 704 705 706 707 708 709 710 711 712 713 |
# File 'lib/kreuzberg/config.rb', line 703 def to_h { algorithm: @algorithm, max_keywords: @max_keywords, min_score: @min_score, ngram_range: @ngram_range, language: @language, yake_params: @yake_params&.to_h, rake_params: @rake_params&.to_h }.compact end |