Method: LicenseMatcher::TFRubyMatcher#initialize

Defined in:
lib/license_matcher/tf_ruby_matcher.rb

#initialize(index_path = DEFAULT_INDEX_PATH) ⇒ TFRubyMatcher

Returns a new instance of TFRubyMatcher.



15
16
17
18
19
20
21
22
23
# File 'lib/license_matcher/tf_ruby_matcher.rb', line 15

def initialize(index_path = DEFAULT_INDEX_PATH)
  spdx_ids, spdx_docs = read_corpus(index_path)

  @spdx_ids = spdx_ids
  @corpus = spdx_docs
  @model = TfIdfSimilarity::BM25Model.new(@corpus, :library => :narray)

  true
end