ots 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/version.h +1 -1
- data/lib/ots/grader.rb +15 -0
- metadata +4 -3
data/ext/version.h
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#pragma once
|
|
2
|
-
#define RUBY_OTS_VERSION "0.5.
|
|
2
|
+
#define RUBY_OTS_VERSION "0.5.3"
|
data/lib/ots/grader.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
|
|
3
|
+
module OTS
|
|
4
|
+
DICTIONARY_PATH = File.absolute_path(File.dirname(__FILE__) + '/../../dictionaries')
|
|
5
|
+
class Grader
|
|
6
|
+
def initialize options = {}
|
|
7
|
+
path = options[:path] || File.join(DICTIONARY_PATH, options.fetch(:language, 'en').to_s + '.xml')
|
|
8
|
+
@xml = Nokogiri::XML(File.read(path))
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def stop_words
|
|
12
|
+
@xml.xpath('//grader-tc/word').map {|word| word.text.downcase}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 5
|
|
8
|
-
-
|
|
9
|
-
version: 0.5.
|
|
8
|
+
- 3
|
|
9
|
+
version: 0.5.3
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Bharanee Rathna
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2012-01-
|
|
17
|
+
date: 2012-01-27 00:00:00 +11:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -74,6 +74,7 @@ files:
|
|
|
74
74
|
- test/test_article.rb
|
|
75
75
|
- test/test_ots.rb
|
|
76
76
|
- test/helper.rb
|
|
77
|
+
- lib/ots/grader.rb
|
|
77
78
|
- README.md
|
|
78
79
|
- CHANGELOG
|
|
79
80
|
- dictionaries/cy.xml
|