Class: OTS::Grader

Inherits:
Object
  • Object
show all
Defined in:
lib/ots/grader.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Grader


5
6
7
8
# File 'lib/ots/grader.rb', line 5

def initialize options = {}
  path = options[:path] || File.join(DICTIONARY_PATH, options.fetch(:language, 'en').to_s + '.xml')
  @xml = Nokogiri::XML(File.read(path))
end

Instance Method Details

#stop_wordsObject


10
11
12
# File 'lib/ots/grader.rb', line 10

def stop_words
  @xml.xpath('//grader-tc/word').map {|word| word.text.downcase}
end