Method: PdfExtract::Language.year_ratio

Defined in:
lib/language.rb

.year_ratio(s) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/language.rb', line 63

def self.year_ratio s
  words = s.split

  year_words = words.map do |word|
    word =~ /[^\d]\d{4}[^\d]/
  end

  year_words.reject { |year_word| not year_word }.length / words.length.to_f
end