fast-stemmer 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -7,6 +7,9 @@ It's in order of magnitude faster (and uses much less memory) than the latter.
7
7
  For the original work please see:
8
8
  http://tartarus.org/~martin/PorterStemmer/
9
9
 
10
+ Gemfile:
11
+ gem 'fast-stemmer'
12
+
10
13
  Usage:
11
14
 
12
15
  require 'rubygems'
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ rescue LoadError
16
16
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
17
17
  end
18
18
 
19
- require 'rake/rdoctask'
19
+ require 'rdoc/task'
20
20
  Rake::RDocTask.new do |rdoc|
21
21
  rdoc.rdoc_dir = 'rdoc'
22
22
  rdoc.title = 'fast-stemmer'
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
- ---
1
+ ---
2
2
  :major: 1
3
3
  :minor: 0
4
- :patch: 0
4
+ :patch: 1
5
+ :build:
data/ext/Makefile ADDED
@@ -0,0 +1,213 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ # V=0 quiet, V=1 verbose. other values don't work.
5
+ V = 0
6
+ Q1 = $(V:1=)
7
+ Q = $(Q1:0=@)
8
+ n=$(NULLCMD)
9
+ ECHO1 = $(V:1=@$n)
10
+ ECHO = $(ECHO1:0=@echo)
11
+
12
+ #### Start of system configuration section. ####
13
+
14
+ srcdir = .
15
+ topdir = /Users/roman/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1
16
+ hdrdir = /Users/roman/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1
17
+ arch_hdrdir = /Users/roman/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/$(arch)
18
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
19
+ prefix = $(DESTDIR)/Users/roman/.rvm/rubies/ruby-1.9.3-p125
20
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
21
+ exec_prefix = $(prefix)
22
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
23
+ sitehdrdir = $(rubyhdrdir)/site_ruby
24
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
25
+ vendordir = $(rubylibprefix)/vendor_ruby
26
+ sitedir = $(rubylibprefix)/site_ruby
27
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
28
+ mandir = $(datarootdir)/man
29
+ localedir = $(datarootdir)/locale
30
+ libdir = $(exec_prefix)/lib
31
+ psdir = $(docdir)
32
+ pdfdir = $(docdir)
33
+ dvidir = $(docdir)
34
+ htmldir = $(docdir)
35
+ infodir = $(datarootdir)/info
36
+ docdir = $(datarootdir)/doc/$(PACKAGE)
37
+ oldincludedir = $(DESTDIR)/usr/include
38
+ includedir = $(prefix)/include
39
+ localstatedir = $(prefix)/var
40
+ sharedstatedir = $(prefix)/com
41
+ sysconfdir = $(prefix)/etc
42
+ datadir = $(datarootdir)
43
+ datarootdir = $(prefix)/share
44
+ libexecdir = $(exec_prefix)/libexec
45
+ sbindir = $(exec_prefix)/sbin
46
+ bindir = $(exec_prefix)/bin
47
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
48
+ archdir = $(rubylibdir)/$(arch)
49
+ sitelibdir = $(sitedir)/$(ruby_version)
50
+ sitearchdir = $(sitelibdir)/$(sitearch)
51
+ vendorlibdir = $(vendordir)/$(ruby_version)
52
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
53
+
54
+ NULLCMD = :
55
+
56
+ CC = clang
57
+ CXX = clang++
58
+ LIBRUBY = $(LIBRUBY_SO)
59
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
60
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
61
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
62
+ OUTFLAG = -o
63
+ COUTFLAG = -o
64
+
65
+ RUBY_EXTCONF_H =
66
+ cflags = $(optflags) $(debugflags) $(warnflags)
67
+ optflags = -O3
68
+ debugflags = -ggdb
69
+ warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration
70
+ CFLAGS = -fno-common $(cflags) -fno-common -pipe $(ARCH_FLAG)
71
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
72
+ DEFS =
73
+ CPPFLAGS = -I/Users/roman/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
74
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
75
+ ldflags = -L.
76
+ dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
77
+ ARCH_FLAG =
78
+ DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
79
+ LDSHARED = $(CC) -dynamic -bundle
80
+ LDSHAREDXX = $(CXX) -dynamic -bundle
81
+ AR = ar
82
+ EXEEXT =
83
+
84
+ RUBY_BASE_NAME = ruby
85
+ RUBY_INSTALL_NAME = ruby
86
+ RUBY_SO_NAME = ruby.1.9.1
87
+ arch = x86_64-darwin11.3.0
88
+ sitearch = $(arch)
89
+ ruby_version = 1.9.1
90
+ ruby = /Users/roman/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
91
+ RUBY = $(ruby)
92
+ RM = rm -f
93
+ RM_RF = $(RUBY) -run -e rm -- -rf
94
+ RMDIRS = rmdir -p
95
+ MAKEDIRS = mkdir -p
96
+ INSTALL = /usr/bin/install -c
97
+ INSTALL_PROG = $(INSTALL) -m 0755
98
+ INSTALL_DATA = $(INSTALL) -m 644
99
+ COPY = cp
100
+
101
+ #### End of system configuration section. ####
102
+
103
+ preload =
104
+
105
+ libpath = . $(libdir) /Users/roman/.rvm/usr/lib
106
+ LIBPATH = -L. -L$(libdir) -L/Users/roman/.rvm/usr/lib
107
+ DEFFILE =
108
+
109
+ CLEANFILES = mkmf.log
110
+ DISTCLEANFILES =
111
+ DISTCLEANDIRS =
112
+
113
+ extout =
114
+ extout_prefix =
115
+ target_prefix =
116
+ LOCAL_LIBS =
117
+ LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
118
+ SRCS = porter.c porter_wrap.c
119
+ OBJS = porter.o porter_wrap.o
120
+ TARGET = stemmer
121
+ DLLIB = $(TARGET).bundle
122
+ EXTSTATIC =
123
+ STATIC_LIB =
124
+
125
+ BINDIR = $(bindir)
126
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
127
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
128
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
129
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
130
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
131
+
132
+ TARGET_SO = $(DLLIB)
133
+ CLEANLIBS = $(TARGET).bundle
134
+ CLEANOBJS = *.o *.bak
135
+
136
+ all: $(DLLIB)
137
+ static: $(STATIC_LIB)
138
+ .PHONY: all install static install-so install-rb
139
+ .PHONY: clean clean-so clean-rb
140
+
141
+ clean-rb-default::
142
+ clean-rb::
143
+ clean-so::
144
+ clean: clean-so clean-rb-default clean-rb
145
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
146
+
147
+ distclean-rb-default::
148
+ distclean-rb::
149
+ distclean-so::
150
+ distclean: clean distclean-so distclean-rb-default distclean-rb
151
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
152
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
153
+ @-$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
154
+
155
+ realclean: distclean
156
+ install: install-so install-rb
157
+
158
+ install-so: $(RUBYARCHDIR)
159
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
160
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
161
+ @-$(MAKEDIRS) $(@D)
162
+ $(INSTALL_PROG) $(DLLIB) $(@D)
163
+ install-rb: pre-install-rb install-rb-default
164
+ install-rb-default: pre-install-rb-default
165
+ pre-install-rb: Makefile
166
+ pre-install-rb-default: Makefile
167
+ pre-install-rb-default:
168
+ $(ECHO) installing default stemmer libraries
169
+ $(RUBYARCHDIR):
170
+ $(Q) $(MAKEDIRS) $@
171
+
172
+ site-install: site-install-so site-install-rb
173
+ site-install-so: install-so
174
+ site-install-rb: install-rb
175
+
176
+ .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
177
+
178
+ .cc.o:
179
+ $(ECHO) compiling $(<)
180
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
181
+
182
+ .mm.o:
183
+ $(ECHO) compiling $(<)
184
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
185
+
186
+ .cxx.o:
187
+ $(ECHO) compiling $(<)
188
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
189
+
190
+ .cpp.o:
191
+ $(ECHO) compiling $(<)
192
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
193
+
194
+ .C.o:
195
+ $(ECHO) compiling $(<)
196
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
197
+
198
+ .c.o:
199
+ $(ECHO) compiling $(<)
200
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
201
+
202
+ .m.o:
203
+ $(ECHO) compiling $(<)
204
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
205
+
206
+ $(DLLIB): $(OBJS) Makefile
207
+ $(ECHO) linking shared-object $(DLLIB)
208
+ @-$(RM) $(@)
209
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
210
+
211
+
212
+
213
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
data/ext/porter_wrap.c CHANGED
@@ -17,25 +17,20 @@ struct stemmer {
17
17
 
18
18
  static VALUE stem_word(VALUE self, VALUE arg)
19
19
  {
20
- int length, i;
20
+ size_t length, i;
21
21
  char *word;
22
- char *res;
23
22
  struct stemmer z;
24
23
  VALUE str, rv;
25
24
 
26
25
  str = StringValue(arg);
27
- word = RSTRING_PTR(str);
26
+ word = malloc(RSTRING_LEN(str) + 1);
27
+ strncpy(word, RSTRING_PTR(str), RSTRING_LEN(str));
28
+ word[RSTRING_LEN(str)] = '\0';
28
29
 
29
30
  length = stem(&z, word, strlen(word)-1);
30
- /* length is the index of last char, add one for size and one for '\0' */
31
- res = (char *)malloc((length+2) * sizeof(char));
32
- for (i=0; i<=length; i++)
33
- {
34
- res[i] = word[i];
35
- }
36
- res[length+1] = 0;
37
- rv = rb_str_new2(res);
38
- free(res);
31
+ word[length+1] = 0;
32
+ rv = rb_str_new2(word);
33
+ free(word);
39
34
  return rv;
40
35
  }
41
36
 
@@ -0,0 +1 @@
1
+ require 'fast_stemmer'
metadata CHANGED
@@ -1,64 +1,58 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fast-stemmer
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Roman Shterenzon
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-11-18 00:00:00 -08:00
13
- default_executable:
12
+ date: 2012-04-06 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
14
  description: Fast Porter stemmer based on a C version of algorithm
17
15
  email: romanbsd@yahoo.com
18
16
  executables: []
19
-
20
- extensions:
17
+ extensions:
21
18
  - ext/extconf.rb
22
- extra_rdoc_files:
19
+ extra_rdoc_files:
23
20
  - LICENSE
24
21
  - README
25
- files:
22
+ files:
26
23
  - LICENSE
27
24
  - README
28
25
  - Rakefile
29
26
  - VERSION.yml
27
+ - ext/Makefile
30
28
  - ext/extconf.rb
31
29
  - ext/porter.c
32
30
  - ext/porter_wrap.c
31
+ - lib/fast-stemmer.rb
33
32
  - lib/fast_stemmer.rb
34
33
  - test/fast_stemmer_test.rb
35
- has_rdoc: true
36
34
  homepage: http://github.com/romanbsd/fast-stemmer
37
35
  licenses: []
38
-
39
36
  post_install_message:
40
- rdoc_options:
41
- - --charset=UTF-8
42
- require_paths:
37
+ rdoc_options: []
38
+ require_paths:
43
39
  - lib
44
- required_ruby_version: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: "0"
49
- version:
50
- required_rubygems_version: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: "0"
55
- version:
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
56
52
  requirements: []
57
-
58
53
  rubyforge_project:
59
- rubygems_version: 1.3.5
54
+ rubygems_version: 1.8.17
60
55
  signing_key:
61
56
  specification_version: 3
62
57
  summary: Fast Porter stemmer based on a C version of algorithm
63
- test_files:
64
- - test/fast_stemmer_test.rb
58
+ test_files: []