Permalink
Browse files

Merged new_layout

  • Loading branch information...
1 parent 40f760c commit 2727aeaa941ace8c1e6d03fbee4bd6a4819255d3 @aurelian committed Oct 28, 2009
Showing with 368 additions and 264 deletions.
  1. +5 −0 .document
  2. +1 −0 .gitignore
  3. +0 −87 Manifest
  4. +61 −0 README.rdoc
  5. +0 −66 README.textile
  6. +64 −28 Rakefile
  7. +1 −0 VERSION
  8. +17 −0 ext/lingua/extconf.rb
  9. +32 −20 ruby-stemmer.c → ext/lingua/stemmer.c
  10. +0 −18 extconf.rb
  11. 0 lib/lingua.rb
  12. +24 −0 lib/lingua/stemmer.rb
  13. +111 −11 ruby-stemmer.gemspec
  14. +0 −34 test.rb
  15. +11 −0 test/helper.rb
  16. +41 −0 test/lingua/test_stemmer.rb
View
@@ -0,0 +1,5 @@
+README.rdoc
+lib/**/*.rb
+bin/*
+features/**/*.feature
+MIT-LICENSE
View
@@ -1,3 +1,4 @@
+rdoc
pkg/*
*.o
*.so
View
@@ -1,87 +0,0 @@
-extconf.rb
-libstemmer_c/examples/stemwords.c
-libstemmer_c/include/libstemmer.h
-libstemmer_c/libstemmer/libstemmer.c
-libstemmer_c/libstemmer/libstemmer_utf8.c
-libstemmer_c/libstemmer/modules.h
-libstemmer_c/libstemmer/modules.txt
-libstemmer_c/libstemmer/modules_utf8.h
-libstemmer_c/libstemmer/modules_utf8.txt
-libstemmer_c/Makefile
-libstemmer_c/MANIFEST
-libstemmer_c/mkinc.mak
-libstemmer_c/mkinc_utf8.mak
-libstemmer_c/README
-libstemmer_c/runtime/api.c
-libstemmer_c/runtime/api.h
-libstemmer_c/runtime/header.h
-libstemmer_c/runtime/utilities.c
-libstemmer_c/src_c/stem_ISO_8859_1_danish.c
-libstemmer_c/src_c/stem_ISO_8859_1_danish.h
-libstemmer_c/src_c/stem_ISO_8859_1_dutch.c
-libstemmer_c/src_c/stem_ISO_8859_1_dutch.h
-libstemmer_c/src_c/stem_ISO_8859_1_english.c
-libstemmer_c/src_c/stem_ISO_8859_1_english.h
-libstemmer_c/src_c/stem_ISO_8859_1_finnish.c
-libstemmer_c/src_c/stem_ISO_8859_1_finnish.h
-libstemmer_c/src_c/stem_ISO_8859_1_french.c
-libstemmer_c/src_c/stem_ISO_8859_1_french.h
-libstemmer_c/src_c/stem_ISO_8859_1_german.c
-libstemmer_c/src_c/stem_ISO_8859_1_german.h
-libstemmer_c/src_c/stem_ISO_8859_1_hungarian.c
-libstemmer_c/src_c/stem_ISO_8859_1_hungarian.h
-libstemmer_c/src_c/stem_ISO_8859_1_italian.c
-libstemmer_c/src_c/stem_ISO_8859_1_italian.h
-libstemmer_c/src_c/stem_ISO_8859_1_norwegian.c
-libstemmer_c/src_c/stem_ISO_8859_1_norwegian.h
-libstemmer_c/src_c/stem_ISO_8859_1_porter.c
-libstemmer_c/src_c/stem_ISO_8859_1_porter.h
-libstemmer_c/src_c/stem_ISO_8859_1_portuguese.c
-libstemmer_c/src_c/stem_ISO_8859_1_portuguese.h
-libstemmer_c/src_c/stem_ISO_8859_1_spanish.c
-libstemmer_c/src_c/stem_ISO_8859_1_spanish.h
-libstemmer_c/src_c/stem_ISO_8859_1_swedish.c
-libstemmer_c/src_c/stem_ISO_8859_1_swedish.h
-libstemmer_c/src_c/stem_ISO_8859_2_romanian.c
-libstemmer_c/src_c/stem_ISO_8859_2_romanian.h
-libstemmer_c/src_c/stem_KOI8_R_russian.c
-libstemmer_c/src_c/stem_KOI8_R_russian.h
-libstemmer_c/src_c/stem_UTF_8_danish.c
-libstemmer_c/src_c/stem_UTF_8_danish.h
-libstemmer_c/src_c/stem_UTF_8_dutch.c
-libstemmer_c/src_c/stem_UTF_8_dutch.h
-libstemmer_c/src_c/stem_UTF_8_english.c
-libstemmer_c/src_c/stem_UTF_8_english.h
-libstemmer_c/src_c/stem_UTF_8_finnish.c
-libstemmer_c/src_c/stem_UTF_8_finnish.h
-libstemmer_c/src_c/stem_UTF_8_french.c
-libstemmer_c/src_c/stem_UTF_8_french.h
-libstemmer_c/src_c/stem_UTF_8_german.c
-libstemmer_c/src_c/stem_UTF_8_german.h
-libstemmer_c/src_c/stem_UTF_8_hungarian.c
-libstemmer_c/src_c/stem_UTF_8_hungarian.h
-libstemmer_c/src_c/stem_UTF_8_italian.c
-libstemmer_c/src_c/stem_UTF_8_italian.h
-libstemmer_c/src_c/stem_UTF_8_norwegian.c
-libstemmer_c/src_c/stem_UTF_8_norwegian.h
-libstemmer_c/src_c/stem_UTF_8_porter.c
-libstemmer_c/src_c/stem_UTF_8_porter.h
-libstemmer_c/src_c/stem_UTF_8_portuguese.c
-libstemmer_c/src_c/stem_UTF_8_portuguese.h
-libstemmer_c/src_c/stem_UTF_8_romanian.c
-libstemmer_c/src_c/stem_UTF_8_romanian.h
-libstemmer_c/src_c/stem_UTF_8_russian.c
-libstemmer_c/src_c/stem_UTF_8_russian.h
-libstemmer_c/src_c/stem_UTF_8_spanish.c
-libstemmer_c/src_c/stem_UTF_8_spanish.h
-libstemmer_c/src_c/stem_UTF_8_swedish.c
-libstemmer_c/src_c/stem_UTF_8_swedish.h
-libstemmer_c/src_c/stem_UTF_8_turkish.c
-libstemmer_c/src_c/stem_UTF_8_turkish.h
-Manifest
-MIT-LICENSE
-Rakefile
-README.textile
-ruby-stemmer.c
-ruby-stemmer.gemspec
-test.rb
View
@@ -0,0 +1,61 @@
+= Ruby-Stemmer
+
+Ruby-Stemmer exposes SnowBall API to Ruby.
+
+This package includes libstemmer_c library released under BSD licence
+and available for free at: http://snowball.tartarus.org/dist/libstemmer_c.tgz.
+
+For details about libstemmer_c please check libstemmer_c/README or http://snowball.tartarus.org.
+
+== What id does?
+
+The stemming process is an algorithm to allow one to find the stem of an word (not the root of it).
+For further reference on stem vs. root, please check wikipedia articles on the topic:
+
+* http://en.wikipedia.org/wiki/Stem_%28linguistics%29
+* http://en.wikipedia.org/wiki/Root_%28linguistics%29
+
+== Install
+
+=== Standard install with:
+
+ gem install ruby-stemmer
+
+Please not that Windows is not supported at this time.
+
+=== Development version
+
+ $ git clone git://github.com/aurelian/ruby-stemmer.git
+ $ cd ruby-stemmer
+ $ rake -T #<== see what we've got
+ $ rake ext
+ $ rake test
+
+== TODO
+
+
+
+== Note on Patches/Pull Requests
+
+* Fork the project from github: http://github.com/aurelian/ruby-stemmer
+* Make your feature addition or bug fix: http://github.com/aurelian/ruby-stemmer/issues
+* Add tests for it. This is important so I don't break it in a
+ future version unintentionally.
+* Commit, do not mess with rakefile, version, or history.
+
+ if you want to have your own version, that is fine but
+ bump version in a commit by itself I can ignore when I pull
+* Send me a pull request. Bonus points for topic branches.
+
+== Copyright
+
+Copyright (c) 2009 Aurelian Oancea. See MIT-LICENSE for details.
+
+== Contributors
+
+
+
+== Real life usage
+
+
+
View
@@ -1,66 +0,0 @@
-h3. About
-
-*ruby-stemmer* exposes SnowBall API stemmer implementation to ruby.
-
-This package includes *libstemmer_c* library - released under BSD licence and available for download at: "http://snowball.tartarus.org/dist/libstemmer_c.tgz":http://snowball.tartarus.org/dist/libstemmer_c.tgz.
-
-For details about *libstemmer_c* please check libstemmer_c/README file or "http://snowball.tartarus.org":http://snowball.tartarus.org.
-
-author: Aurelian Oancea, oancea at gmail.com
-
-licence: MIT, see MIT-LICENSE file for details
-
-
-h4. Install
-
-
-Please use sudo or run as root if you get in to _Permission Deny_ issues.
-
-h5. Stable version - with rubygems:
-
- @$ gem install ruby-stemmer@
-
-h5. Development version - from source
-
- $ ruby extconf.rb # => compile libstemmer_c and generate a Makefile
- $ make # => compile the library
- $ ./test.rb # => test it :)
- $ make install # => to install
-
-
-h4. Usage
-
-Please refer to @test.rb@.
-
-
-h4. API
-
-<pre>
- module Lingua
- class Steemer
-
- # creates a new Steemer,
- # defaults: language => en, encoding => UTF_8
- # pass :language or :encoding to change them
- def initialize
- end
-
- # stemms the word
- def stem(word)
- end
-
- # gets the length of the last stemmed word
- # same as:
- # word = Lingua::Steemer.new.stem("installation") # ==> install (string)
- # word.length # ==> 6 (int)
- def length
- end
- end
- end
-</pre>
-
-
-h4. Todo
-
-* Add (Array of Hashes) Lingua::Stemmer.list to list available languages/encodings
-* Windows?
View
@@ -1,39 +1,75 @@
require 'rubygems'
require 'rake'
-require 'echoe'
-
-Echoe.new('ruby-stemmer', '0.5.5') do |p|
- p.description = "Stemmer implementation to ruby using libstemmer_c."
- p.url = "http://github.com/aurelian/ruby-stemmer"
- p.author = "Aurelian Oancea, Yury Korolev"
- p.email = "oancea@gmail.com, yury.korolev@gmail.com"
- p.extensions = ["extconf.rb"]
- p.ignore_pattern = ["*.o", "**/*.o", "stemwords", "*.bundle", "*.a", "*.so"]
- p.development_dependencies = []
- p.runtime_dependencies = []
- p.has_rdoc = true
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "ruby-stemmer"
+ gem.summary = %Q{Expose libstemmer_c to Ruby.}
+ gem.description = %Q{Expose the bundled libstemmer_c library to Ruby.}
+ gem.email = "oancea@gmail.com"
+ gem.homepage = "http://github.com/aurelian/ruby-stemmer"
+ gem.authors = ["Aurelian Oancea", "Yury Korolev"]
+ gem.extensions = ["ext/lingua/extconf.rb"]
+ gem.rubyforge_project = "ruby-stemmer"
+ gem.files = FileList['lib/**/*.rb', 'README.rdoc', 'MIT-LICENSE', 'VERSION', 'Rakefile', 'libstemmer_c/**/*', 'ext/**/*', 'test/**/*']
+ %w(ext/lingua/*.so ext/lingua/*.bundle ext/lingua/Makefile ext/lingua/mkmf.log ext/lingua/*.o libstemmer_c/**/*.o).each do | f |
+ gem.files.exclude f
+ end
+ # gem.ignore_pattern = ["*.o", "**/*.o", "stemwords", "*.bundle", "*.a", "*.so", "Makefile"]
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ end
+ Jeweler::GemcutterTasks.new
+ Jeweler::RubyforgeTasks.new do |rubyforge|
+ rubyforge.doc_task = "rdoc"
+ end
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
+end
+
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |test|
+ test.libs << 'lib' << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
end
-rm_rf 'Makefile'
+begin
+ require 'rcov/rcovtask'
+ Rcov::RcovTask.new do |test|
+ test.libs << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
+ end
+rescue LoadError
+ task :rcov do
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
+ end
+end
-PKG_FILES = FileList[
- 'extconf.rb',
- 'ruby-stemmer.c',
- 'test.rb',
- '[A-Z]*',
- 'libstemmer_c/**/*'
-]
+task :test => :check_dependencies
-PKG_FILES.exclude('*.o')
-PKG_FILES.exclude('**/*.o')
-PKG_FILES.exclude('stemwords')
-PKG_FILES.exclude('*.bundle')
-PKG_FILES.exclude('*.a')
-PKG_FILES.exclude('*.so')
+task :default => :test
-desc "Cleans the workspace"
+desc "Cleans the project"
task :clean do
- `rm -rf Makefile mkmf.log ruby-stemmer.o stemmer.bundle stemmer.so`
+ `cd ext/lingua && rm -rf Makefile mkmf.log stemmer.o stemmer_native.bundle stemmer.so; cd ../../`
`cd libstemmer_c && make clean && cd ../`
end
+desc "Builds the extension"
+task :ext => :clean do
+ `cd ext/lingua/ && ruby extconf.rb && make && cd ../../`
+end
+
+require 'rake/rdoctask'
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "Ruby-Stemmer #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+ rdoc.rdoc_files.include('ext/lingua/stemmer.c')
+ rdoc.rdoc_files.include('MIT-LICENSE')
+end
View
@@ -0,0 +1 @@
+0.6.2
View
@@ -0,0 +1,17 @@
+ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /universal-darwin/
+require "mkmf"
+
+ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
+LIBSTEMMER = File.join(ROOT, 'libstemmer_c')
+
+# build libstemmer_c
+ENV['ARCHFLAGS']= "-arch #{Config::CONFIG['host_cpu']}" if RUBY_PLATFORM =~ /darwin/
+ENV['ARCHFLAGS']= "-arch x86_64" if Config::CONFIG['host_cpu'] == 'i686' && RUBY_PLATFORM =~ /darwin/
+system "cd #{LIBSTEMMER}; make libstemmer.o; cd #{ROOT};"
+
+$CFLAGS += " -I#{File.join(LIBSTEMMER, 'include')} "
+$libs += " -L#{LIBSTEMMER} #{File.join(LIBSTEMMER, 'libstemmer.o')} "
+
+if have_header("libstemmer.h")
+ create_makefile("lingua/stemmer_native")
+end
Oops, something went wrong.

0 comments on commit 2727aea

Please sign in to comment.