Module: PdfExtract::Score

Defined in:
lib/references/score.rb

Constant Summary collapse

@@reference_model =
Model.new(path_to_data("reference.model"))

Class Method Summary collapse

Class Method Details

.path_to_data(data_filename) ⇒ Object



6
7
8
# File 'lib/references/score.rb', line 6

def self.path_to_data data_filename
  File.join(File.dirname(File.expand_path(__FILE__)), "../../data/" + data_filename)
end

.reference?(section) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/references/score.rb', line 12

def self.reference? section
  sample = {
    1 => section[:letter_ratio],
    2 => section[:name_ratio],
    3 => section[:year_ratio],
    4 => section[:cap_ratio],
    5 => section[:lateness]
  }

  puts sample

  puts @@reference_model.predict(sample)
  @@reference_model.predict(sample) > 0
end