Skip to content

Commit

Permalink
encoding name
Browse files Browse the repository at this point in the history
  • Loading branch information
luisparravicini committed Dec 27, 2009
1 parent 1734d1e commit 60af1dd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can specify language and encoding for internal stemmer:
b = Classifier::Bayes.new :categories => ['Interesting', 'Uninteresting'],
:language => 'ro', :encoding => 'ISO_8859_2'

The default values are 'en' for language and 'UTF-8' for the encoding.
The default values are 'en' for language and 'UTF_8' for the encoding. The encoding name must have underscores instead of hyphens (i.e.: UTF_8 instead of UTF-8).

Each language uses a word list to exclude certain words (stopwords). classifier comes with three included stopword lists, for English, Russian and Spanish.
The English list is the one that comes with the original gem (don't know where it was taken from) and the Russian and Spanish are from snowball[http://snowball.tartarus.org/algorithms/].
Expand Down
2 changes: 1 addition & 1 deletion luisparravicini-classifier.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Gem::Specification.new do |s|
s.name = %q{luisparravicini-classifier}
s.version = "1.3.9"
s.version = "1.4.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Luis Parravicini"]
Expand Down
Binary file added pkg/luisparravicini-classifier-1.4.0.gem
Binary file not shown.
11 changes: 6 additions & 5 deletions test/bayes/bayesian_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding:utf-8

require File.dirname(__FILE__) + '/../test_helper'

class BayesianTest < Test::Unit::TestCase
def setup
@classifier = Classifier::Bayes.new :categories => ['Interesting', 'Uninteresting']
Expand Down Expand Up @@ -57,11 +58,11 @@ def test_case_insensitive

def test_serialize
txt = "this can be serialized"
b = Classifier::Bayes.new(:categories => ['Interesting', 'Uninteresting'])
b.train_interesting(txt)
b.train_uninteresting("really uninteresting")
@classifier.train_interesting(txt)
@classifier.train_uninteresting("really uninteresting")

b2 = Marshal::load(Marshal::dump(b))
assert_equal b.classify(txt), b2.classify(txt)
b2 = Marshal::load(Marshal::dump(@classifier))
assert_equal @classifier.classify(txt), b2.classify(txt)
end

end

0 comments on commit 60af1dd

Please sign in to comment.