stemmify 0.0.1
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/Rakefile +8 -0
- data/bin/stem +9 -0
- data/init.rb +1 -0
- data/lib/stemmify.rb +184 -0
- data/test/input.txt +23532 -0
- data/test/output.txt +23532 -0
- data/test/test_stemmify.rb +27 -0
- metadata +73 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'stemmify'
|
3
|
+
|
4
|
+
class StemmifyTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def read_as_array(filename)
|
7
|
+
file = File.open(filename)
|
8
|
+
|
9
|
+
lines = []
|
10
|
+
file.each { |line|
|
11
|
+
lines << line.chomp
|
12
|
+
}
|
13
|
+
return lines
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_stem
|
17
|
+
# assuming we will run the test from the root directory of the project
|
18
|
+
# using "rake test" from the command-line
|
19
|
+
input_words = read_as_array("test/input.txt")
|
20
|
+
output_words = read_as_array("test/output.txt")
|
21
|
+
|
22
|
+
for i in 0 ... input_words.length()
|
23
|
+
assert_equal(output_words[i], input_words[i].stem, "input: " + input_words[i])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stemmify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ray Pereda
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-26 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Stem words, for example, convert running to run
|
22
|
+
email: raypereda@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- Rakefile
|
31
|
+
- init.rb
|
32
|
+
- lib/stemmify.rb
|
33
|
+
- bin/stem
|
34
|
+
- test/test_stemmify.rb
|
35
|
+
- test/input.txt
|
36
|
+
- test/output.txt
|
37
|
+
homepage: http://rubygems.org/gems/stemmify
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.8.11
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Stemming reducing an inflected word to its root form (approximately). For example, running reduces to run.
|
70
|
+
test_files:
|
71
|
+
- test/test_stemmify.rb
|
72
|
+
- test/input.txt
|
73
|
+
- test/output.txt
|