ruby-stemmer 0.9.2-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +21 -0
- data/README.rdoc +108 -0
- data/Rakefile +70 -0
- data/TODO +0 -0
- data/VERSION +1 -0
- data/ext/lingua/extconf.rb +40 -0
- data/ext/lingua/stemmer.c +115 -0
- data/lib/lingua/1.8/stemmer_native.so +0 -0
- data/lib/lingua/1.9/stemmer_native.so +0 -0
- data/lib/lingua/stemmer.rb +60 -0
- data/libstemmer_c/MANIFEST +72 -0
- data/libstemmer_c/Makefile +9 -0
- data/libstemmer_c/Makefile.windows +15 -0
- data/libstemmer_c/README +125 -0
- data/libstemmer_c/examples/stemwords.c +209 -0
- data/libstemmer_c/include/libstemmer.h +79 -0
- data/libstemmer_c/libstemmer/libstemmer.c +93 -0
- data/libstemmer_c/libstemmer/libstemmer_utf8.c +93 -0
- data/libstemmer_c/libstemmer/modules.h +195 -0
- data/libstemmer_c/libstemmer/modules.txt +51 -0
- data/libstemmer_c/libstemmer/modules_utf8.h +123 -0
- data/libstemmer_c/libstemmer/modules_utf8.txt +50 -0
- data/libstemmer_c/mkinc.mak +86 -0
- data/libstemmer_c/mkinc_utf8.mak +54 -0
- data/libstemmer_c/runtime/api.c +66 -0
- data/libstemmer_c/runtime/api.h +26 -0
- data/libstemmer_c/runtime/header.h +58 -0
- data/libstemmer_c/runtime/utilities.c +478 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_danish.c +337 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_danish.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_dutch.c +624 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_dutch.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_english.c +1117 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_english.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_finnish.c +762 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_finnish.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_french.c +1246 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_french.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_german.c +503 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_german.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_hungarian.c +1230 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_hungarian.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_italian.c +1065 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_italian.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_latin.c +443 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_latin.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_norwegian.c +297 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_norwegian.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_porter.c +749 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_porter.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_portuguese.c +1017 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_portuguese.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_spanish.c +1093 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_spanish.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_swedish.c +307 -0
- data/libstemmer_c/src_c/stem_ISO_8859_1_swedish.h +16 -0
- data/libstemmer_c/src_c/stem_ISO_8859_2_romanian.c +998 -0
- data/libstemmer_c/src_c/stem_ISO_8859_2_romanian.h +16 -0
- data/libstemmer_c/src_c/stem_KOI8_R_russian.c +700 -0
- data/libstemmer_c/src_c/stem_KOI8_R_russian.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_danish.c +339 -0
- data/libstemmer_c/src_c/stem_UTF_8_danish.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_dutch.c +634 -0
- data/libstemmer_c/src_c/stem_UTF_8_dutch.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_english.c +1125 -0
- data/libstemmer_c/src_c/stem_UTF_8_english.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_finnish.c +768 -0
- data/libstemmer_c/src_c/stem_UTF_8_finnish.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_french.c +1256 -0
- data/libstemmer_c/src_c/stem_UTF_8_french.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_german.c +509 -0
- data/libstemmer_c/src_c/stem_UTF_8_german.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_hungarian.c +1234 -0
- data/libstemmer_c/src_c/stem_UTF_8_hungarian.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_italian.c +1073 -0
- data/libstemmer_c/src_c/stem_UTF_8_italian.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_latin.c +443 -0
- data/libstemmer_c/src_c/stem_UTF_8_latin.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_norwegian.c +299 -0
- data/libstemmer_c/src_c/stem_UTF_8_norwegian.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_porter.c +755 -0
- data/libstemmer_c/src_c/stem_UTF_8_porter.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_portuguese.c +1023 -0
- data/libstemmer_c/src_c/stem_UTF_8_portuguese.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_romanian.c +1004 -0
- data/libstemmer_c/src_c/stem_UTF_8_romanian.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_russian.c +694 -0
- data/libstemmer_c/src_c/stem_UTF_8_russian.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_spanish.c +1097 -0
- data/libstemmer_c/src_c/stem_UTF_8_spanish.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_swedish.c +309 -0
- data/libstemmer_c/src_c/stem_UTF_8_swedish.h +16 -0
- data/libstemmer_c/src_c/stem_UTF_8_turkish.c +2205 -0
- data/libstemmer_c/src_c/stem_UTF_8_turkish.h +16 -0
- data/test/helper.rb +3 -0
- data/test/lingua/test_stemmer.rb +99 -0
- metadata +162 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
/* This file was generated automatically by the Snowball to ANSI C compiler */
|
3
|
+
|
4
|
+
#ifdef __cplusplus
|
5
|
+
extern "C" {
|
6
|
+
#endif
|
7
|
+
|
8
|
+
extern struct SN_env * turkish_UTF_8_create_env(void);
|
9
|
+
extern void turkish_UTF_8_close_env(struct SN_env * z);
|
10
|
+
|
11
|
+
extern int turkish_UTF_8_stem(struct SN_env * z);
|
12
|
+
|
13
|
+
#ifdef __cplusplus
|
14
|
+
}
|
15
|
+
#endif
|
16
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestStemmer < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_stemmer_creation
|
7
|
+
assert_kind_of ::Lingua::Stemmer, ::Lingua::Stemmer.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_exceptions
|
11
|
+
assert_raise ::Lingua::StemmerError do
|
12
|
+
# invalid encoding for language
|
13
|
+
::Lingua::Stemmer.new :language => "ro", :encoding => "ISO_8859_1"
|
14
|
+
end
|
15
|
+
assert_raise ::Lingua::StemmerError do
|
16
|
+
# invalid language
|
17
|
+
::Lingua::Stemmer.new :language => "cat"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_latin
|
22
|
+
assert_nothing_raised do
|
23
|
+
::Lingua::Stemmer.new :language => "latin", :encoding => "ISO_8859_1"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_stem
|
28
|
+
s= ::Lingua::Stemmer.new(:language => "en", :encoding => "UTF_8")
|
29
|
+
assert_equal s.stem("obnoxious"), "obnoxi"
|
30
|
+
assert_equal s.stem("personalities"), "person"
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_string_stemmer
|
34
|
+
assert_equal ::Lingua.stemmer("installation", :language => "en"), "instal"
|
35
|
+
stemmer= ::Lingua.stemmer("installation", :language => "fr") do | word |
|
36
|
+
assert_equal word, "install"
|
37
|
+
end
|
38
|
+
assert_kind_of ::Lingua::Stemmer, stemmer
|
39
|
+
|
40
|
+
if RUBY_VERSION >= '1.9'
|
41
|
+
assert_equal stemmer.encoding, Encoding::UTF_8
|
42
|
+
else
|
43
|
+
assert_equal stemmer.encoding, "UTF_8"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_array_stemmer
|
48
|
+
results= ::Lingua.stemmer(["one", "two"], :language => "de", :encoding => "ISO_8859_1")
|
49
|
+
assert_equal 2, results.size
|
50
|
+
assert_kind_of Array, results
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_stemmer_subclass
|
54
|
+
assert_raises(RuntimeError) do
|
55
|
+
Class.new(Lingua::Stemmer) {
|
56
|
+
def native_init a, b; end
|
57
|
+
}.new.stem('cow')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_default_encoding_option
|
62
|
+
if RUBY_VERSION >= '1.9'
|
63
|
+
assert_equal ::Lingua::Stemmer.new.encoding, Encoding::UTF_8
|
64
|
+
else
|
65
|
+
assert_equal ::Lingua::Stemmer.new.encoding, "UTF_8"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_different_encoding_options
|
70
|
+
if RUBY_VERSION >= '1.9'
|
71
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => "ISO_8859_1").encoding, Encoding::ISO_8859_1
|
72
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => "UTF-8").encoding, Encoding::UTF_8
|
73
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => "utf-8").encoding, Encoding::UTF_8
|
74
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => :ISO_8859_1).encoding, Encoding::ISO_8859_1
|
75
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => Encoding::UTF_8).encoding, Encoding::UTF_8
|
76
|
+
else
|
77
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => "ISO_8859_1").encoding, "ISO_8859_1"
|
78
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => "UTF-8").encoding, "UTF_8"
|
79
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => "utf-8").encoding, "UTF_8"
|
80
|
+
assert_equal ::Lingua::Stemmer.new(:encoding => :ISO_8859_1).encoding, "ISO_8859_1"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if RUBY_VERSION >= '1.9'
|
85
|
+
def test_string_encoding
|
86
|
+
word = "așezare"
|
87
|
+
|
88
|
+
stem = ::Lingua.stemmer(word, :language => "ro", :encoding => "UTF_8")
|
89
|
+
assert_equal word.encoding, stem.encoding
|
90
|
+
|
91
|
+
s = ::Lingua::Stemmer.new(:language => "ro", :encoding => "UTF_8")
|
92
|
+
assert_equal s.stem(word).encoding, word.encoding
|
93
|
+
|
94
|
+
stem = ::Lingua.stemmer("installation", :language => "fr", :encoding => "ISO-8859-1")
|
95
|
+
assert_equal stem.encoding, Encoding::ISO_8859_1
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-stemmer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 63
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 2
|
10
|
+
version: 0.9.2
|
11
|
+
platform: x86-mswin32
|
12
|
+
authors:
|
13
|
+
- Aurelian Oancea
|
14
|
+
- Yury Korolev
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-11-03 00:00:00 Z
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Expose the bundled libstemmer_c library to Ruby.
|
23
|
+
email: oancea@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.rdoc
|
30
|
+
- TODO
|
31
|
+
files:
|
32
|
+
- lib/lingua/stemmer.rb
|
33
|
+
- README.rdoc
|
34
|
+
- MIT-LICENSE
|
35
|
+
- VERSION
|
36
|
+
- Rakefile
|
37
|
+
- libstemmer_c/examples/stemwords.c
|
38
|
+
- libstemmer_c/include/libstemmer.h
|
39
|
+
- libstemmer_c/libstemmer/libstemmer.c
|
40
|
+
- libstemmer_c/libstemmer/libstemmer_utf8.c
|
41
|
+
- libstemmer_c/libstemmer/modules.h
|
42
|
+
- libstemmer_c/libstemmer/modules.txt
|
43
|
+
- libstemmer_c/libstemmer/modules_utf8.h
|
44
|
+
- libstemmer_c/libstemmer/modules_utf8.txt
|
45
|
+
- libstemmer_c/Makefile
|
46
|
+
- libstemmer_c/Makefile.windows
|
47
|
+
- libstemmer_c/MANIFEST
|
48
|
+
- libstemmer_c/mkinc.mak
|
49
|
+
- libstemmer_c/mkinc_utf8.mak
|
50
|
+
- libstemmer_c/README
|
51
|
+
- libstemmer_c/runtime/api.c
|
52
|
+
- libstemmer_c/runtime/api.h
|
53
|
+
- libstemmer_c/runtime/header.h
|
54
|
+
- libstemmer_c/runtime/utilities.c
|
55
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_danish.c
|
56
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_danish.h
|
57
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_dutch.c
|
58
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_dutch.h
|
59
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_english.c
|
60
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_english.h
|
61
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_finnish.c
|
62
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_finnish.h
|
63
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_french.c
|
64
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_french.h
|
65
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_german.c
|
66
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_german.h
|
67
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_hungarian.c
|
68
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_hungarian.h
|
69
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_italian.c
|
70
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_italian.h
|
71
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_latin.c
|
72
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_latin.h
|
73
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_norwegian.c
|
74
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_norwegian.h
|
75
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_porter.c
|
76
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_porter.h
|
77
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_portuguese.c
|
78
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_portuguese.h
|
79
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_spanish.c
|
80
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_spanish.h
|
81
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_swedish.c
|
82
|
+
- libstemmer_c/src_c/stem_ISO_8859_1_swedish.h
|
83
|
+
- libstemmer_c/src_c/stem_ISO_8859_2_romanian.c
|
84
|
+
- libstemmer_c/src_c/stem_ISO_8859_2_romanian.h
|
85
|
+
- libstemmer_c/src_c/stem_KOI8_R_russian.c
|
86
|
+
- libstemmer_c/src_c/stem_KOI8_R_russian.h
|
87
|
+
- libstemmer_c/src_c/stem_UTF_8_danish.c
|
88
|
+
- libstemmer_c/src_c/stem_UTF_8_danish.h
|
89
|
+
- libstemmer_c/src_c/stem_UTF_8_dutch.c
|
90
|
+
- libstemmer_c/src_c/stem_UTF_8_dutch.h
|
91
|
+
- libstemmer_c/src_c/stem_UTF_8_english.c
|
92
|
+
- libstemmer_c/src_c/stem_UTF_8_english.h
|
93
|
+
- libstemmer_c/src_c/stem_UTF_8_finnish.c
|
94
|
+
- libstemmer_c/src_c/stem_UTF_8_finnish.h
|
95
|
+
- libstemmer_c/src_c/stem_UTF_8_french.c
|
96
|
+
- libstemmer_c/src_c/stem_UTF_8_french.h
|
97
|
+
- libstemmer_c/src_c/stem_UTF_8_german.c
|
98
|
+
- libstemmer_c/src_c/stem_UTF_8_german.h
|
99
|
+
- libstemmer_c/src_c/stem_UTF_8_hungarian.c
|
100
|
+
- libstemmer_c/src_c/stem_UTF_8_hungarian.h
|
101
|
+
- libstemmer_c/src_c/stem_UTF_8_italian.c
|
102
|
+
- libstemmer_c/src_c/stem_UTF_8_italian.h
|
103
|
+
- libstemmer_c/src_c/stem_UTF_8_latin.c
|
104
|
+
- libstemmer_c/src_c/stem_UTF_8_latin.h
|
105
|
+
- libstemmer_c/src_c/stem_UTF_8_norwegian.c
|
106
|
+
- libstemmer_c/src_c/stem_UTF_8_norwegian.h
|
107
|
+
- libstemmer_c/src_c/stem_UTF_8_porter.c
|
108
|
+
- libstemmer_c/src_c/stem_UTF_8_porter.h
|
109
|
+
- libstemmer_c/src_c/stem_UTF_8_portuguese.c
|
110
|
+
- libstemmer_c/src_c/stem_UTF_8_portuguese.h
|
111
|
+
- libstemmer_c/src_c/stem_UTF_8_romanian.c
|
112
|
+
- libstemmer_c/src_c/stem_UTF_8_romanian.h
|
113
|
+
- libstemmer_c/src_c/stem_UTF_8_russian.c
|
114
|
+
- libstemmer_c/src_c/stem_UTF_8_russian.h
|
115
|
+
- libstemmer_c/src_c/stem_UTF_8_spanish.c
|
116
|
+
- libstemmer_c/src_c/stem_UTF_8_spanish.h
|
117
|
+
- libstemmer_c/src_c/stem_UTF_8_swedish.c
|
118
|
+
- libstemmer_c/src_c/stem_UTF_8_swedish.h
|
119
|
+
- libstemmer_c/src_c/stem_UTF_8_turkish.c
|
120
|
+
- libstemmer_c/src_c/stem_UTF_8_turkish.h
|
121
|
+
- ext/lingua/extconf.rb
|
122
|
+
- ext/lingua/stemmer.c
|
123
|
+
- test/helper.rb
|
124
|
+
- test/lingua/test_stemmer.rb
|
125
|
+
- TODO
|
126
|
+
- lib/lingua/1.8/stemmer_native.so
|
127
|
+
- lib/lingua/1.9/stemmer_native.so
|
128
|
+
homepage: http://github.com/aurelian/ruby-stemmer
|
129
|
+
licenses: []
|
130
|
+
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
requirements: []
|
155
|
+
|
156
|
+
rubyforge_project: ruby-stemmer
|
157
|
+
rubygems_version: 1.8.11
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: Expose libstemmer_c to Ruby.
|
161
|
+
test_files: []
|
162
|
+
|