Text 1.0.0 → 1.1.0
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/lib/text.rb +1 -0
- data/lib/text/porter_stemming.rb +171 -0
- data/rakefile.rb +2 -2
- data/test/data/porter_stemming_input.txt +23531 -0
- data/test/data/porter_stemming_output.txt +23531 -0
- data/test/porter_stemming_test.rb +16 -0
- metadata +6 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'preamble')
|
|
2
|
+
|
|
3
|
+
class PorterStemmingTest < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
def slurp(*path)
|
|
6
|
+
File.read(File.rel(*path)).split(/\n/)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def test_cases
|
|
10
|
+
cases = slurp('data', 'porter_stemming_input.txt').zip(slurp('data', 'porter_stemming_output.txt'))
|
|
11
|
+
cases.each do |word, expected_output|
|
|
12
|
+
assert_equal expected_output, Text::PorterStemming.stem(word)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
metadata
CHANGED
|
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
|
3
3
|
specification_version: 1
|
|
4
4
|
name: Text
|
|
5
5
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 1.
|
|
7
|
-
date: 2006-
|
|
6
|
+
version: 1.1.0
|
|
7
|
+
date: 2006-10-14 00:00:00 +01:00
|
|
8
8
|
summary: A collection of text algorithms
|
|
9
9
|
require_paths:
|
|
10
10
|
- lib
|
|
@@ -34,6 +34,7 @@ files:
|
|
|
34
34
|
- lib/text/figlet.rb
|
|
35
35
|
- lib/text/levenshtein.rb
|
|
36
36
|
- lib/text/metaphone.rb
|
|
37
|
+
- lib/text/porter_stemming.rb
|
|
37
38
|
- lib/text/soundex.rb
|
|
38
39
|
- lib/text/figlet/font.rb
|
|
39
40
|
- lib/text/figlet/smusher.rb
|
|
@@ -42,6 +43,7 @@ files:
|
|
|
42
43
|
- test/figlet_test.rb
|
|
43
44
|
- test/levenshtein_test.rb
|
|
44
45
|
- test/metaphone_test.rb
|
|
46
|
+
- test/porter_stemming_test.rb
|
|
45
47
|
- test/preamble.rb
|
|
46
48
|
- test/soundex_test.rb
|
|
47
49
|
- test/data/big.flf
|
|
@@ -51,6 +53,8 @@ files:
|
|
|
51
53
|
- test/data/double_metaphone.csv
|
|
52
54
|
- test/data/metaphone.txt
|
|
53
55
|
- test/data/metaphone_buggy.txt
|
|
56
|
+
- test/data/porter_stemming_input.txt
|
|
57
|
+
- test/data/porter_stemming_output.txt
|
|
54
58
|
- rakefile.rb
|
|
55
59
|
test_files: []
|
|
56
60
|
|