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.
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
# File 'lib/kreuzberg/config.rb', line 699 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.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def algorithm @algorithm end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def language @language end |
#max_keywords ⇒ Object (readonly)
Returns the value of attribute max_keywords.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def max_keywords @max_keywords end |
#min_score ⇒ Object (readonly)
Returns the value of attribute min_score.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def min_score @min_score end |
#ngram_range ⇒ Object (readonly)
Returns the value of attribute ngram_range.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def ngram_range @ngram_range end |
#rake_params ⇒ Object (readonly)
Returns the value of attribute rake_params.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def rake_params @rake_params end |
#yake_params ⇒ Object (readonly)
Returns the value of attribute yake_params.
696 697 698 |
# File 'lib/kreuzberg/config.rb', line 696 def yake_params @yake_params end |
Instance Method Details
#to_h ⇒ Object
717 718 719 720 721 722 723 724 725 726 727 |
# File 'lib/kreuzberg/config.rb', line 717 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 |