Sha256: 6c7ecff59b7f8203809788c8bcdc942e6ee310af610761f94b2ef1ad73e57d90

Contents?: true

Size: 664 Bytes

Versions: 46

Compression:

Stored size: 664 Bytes

Contents

# Copyright (C) 2008, KURODA Hiraku <hiraku@hinet.mydns.jp>
# You can redistribute it and/or modify it under GPL2.

require "bayes"
require "kconv"

module Bayes
	module CHARSET
		module EUC
			KCONV = Kconv::EUC
		end

		module UTF8
			KCONV = Kconv::UTF8
		end
	end

	class FilterBase
		def convert_corpus(corpus, to_code, from_code)
			r = self.class::Corpus.new
			corpus.each do |k, v|
				r[k.kconv(to_code::KCONV, from_code::KCONV)] = v
			end
			r
		end
		private :convert_corpus

		def convert(to_code, from_code)
			@charset = to_code
			@ham = convert_corpus(@ham, to_code, from_code)
			@spam = convert_corpus(@spam, to_code, from_code)
		end
	end
end

Version data entries

46 entries across 40 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 lib/bayes/convert.rb
tdiary-contrib-5.2.4 lib/bayes/convert.rb
tdiary-contrib-5.2.3 lib/bayes/convert.rb
tdiary-contrib-5.2.2 lib/bayes/convert.rb
tdiary-contrib-5.2.1 lib/bayes/convert.rb
tdiary-contrib-5.2.0 lib/bayes/convert.rb
tdiary-contrib-5.1.7 lib/bayes/convert.rb
tdiary-contrib-5.1.6 lib/bayes/convert.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/lib/bayes/convert.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/lib/bayes/convert.rb
tdiary-contrib-5.1.5 lib/bayes/convert.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/lib/bayes/convert.rb
tdiary-contrib-5.1.4 lib/bayes/convert.rb
tdiary-contrib-5.1.3 lib/bayes/convert.rb
tdiary-contrib-5.1.2 lib/bayes/convert.rb
tdiary-contrib-5.1.1 lib/bayes/convert.rb
tdiary-contrib-5.1.0 lib/bayes/convert.rb
tdiary-contrib-5.0.13 lib/bayes/convert.rb
tdiary-contrib-5.0.12 lib/bayes/convert.rb
tdiary-contrib-5.0.11 lib/bayes/convert.rb