Method: TermExtract#initialize

Defined in:
lib/term-extract.rb

#initialize(options = {}) ⇒ TermExtract

Returns a new instance of TermExtract.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/term-extract.rb', line 21

def initialize(options = {})
  # The minimum number of times a single word term must occur to be included in the results
  @min_occurance = options.key?(:min_occurance) ? options.delete(:min_occurance) : 3
  # Always include multiword terms that comprise more than @min_terms words
  @min_terms = options.key?(:min_terms) ? options.delete(:min_terms) : 2
  # Extract proper nouns (:nnp) or nouns (:nn) or both (:all)
  @types = options.key?(:types) ? options.delete(:types) : :all
  # Include the extracted POS tags in the results
  @include_tags = options.key?(:include_tags) ? options.delete(:include_tags) : false
  # Remove shorter terms that are part of larger ones
  @collapse_terms = options.key?(:collapse_terms) ? options.delete(:collapse_terms) : true
  #@lazy = options.key?(:lazy) ? options.delete(:lazy) : false
end