Class: OTS::Grader
- Inherits:
-
Object
- Object
- OTS::Grader
- Defined in:
- lib/ots/grader.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Grader
constructor
A new instance of Grader.
- #stop_words ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Grader
Returns a new instance of Grader.
5 6 7 8 |
# File 'lib/ots/grader.rb', line 5 def initialize = {} path = [:path] || File.join(DICTIONARY_PATH, .fetch(:language, 'en').to_s + '.xml') @xml = Nokogiri::XML(File.read(path)) end |
Instance Method Details
#stop_words ⇒ Object
10 11 12 |
# File 'lib/ots/grader.rb', line 10 def stop_words @xml.xpath('//grader-tc/word').map {|word| word.text.downcase} end |