Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,26 @@ Metrics/BlockLength:
Exclude:
- 'test/**/*'
- 'lib/classifier/extensions/vector.rb'
- 'lib/classifier/cli.rb'

# Allow longer methods in complex algorithms (SVD, etc.)
# Allow longer methods in complex algorithms (SVD, etc.) and CLI
Metrics/MethodLength:
Max: 25
Exclude:
- 'test/**/*'
- 'lib/classifier/extensions/vector.rb'
- 'lib/classifier/lsi/content_node.rb'
- 'lib/classifier/cli.rb'

# Allow higher complexity for mathematical algorithms
# Allow higher complexity for mathematical algorithms and CLI
Metrics/AbcSize:
Max: 30
Exclude:
- 'test/**/*'
- 'lib/classifier/extensions/vector.rb'
- 'lib/classifier/lsi.rb'
- 'lib/classifier/lsi/content_node.rb'
- 'lib/classifier/cli.rb'

Metrics/CyclomaticComplexity:
Max: 10
Expand All @@ -59,12 +62,13 @@ Metrics/PerceivedComplexity:
- 'lib/classifier/extensions/vector.rb'
- 'lib/classifier/lsi/content_node.rb'

# Class length limits - algorithms and tests can be longer
# Class length limits - algorithms, tests and CLI can be longer
Metrics/ClassLength:
Max: 250
Exclude:
- 'test/**/*'
- 'lib/classifier/lsi.rb'
- 'lib/classifier/cli.rb'

# SV_decomp is a standard algorithm name
Naming/MethodName:
Expand Down
8 changes: 6 additions & 2 deletions classifier.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require_relative 'lib/classifier/version'

Gem::Specification.new do |s|
s.name = 'classifier'
s.version = '2.2.0'
s.version = Classifier::VERSION
s.summary = 'Text classification with Bayesian, LSI, Logistic Regression, kNN, and TF-IDF vectorization.'
s.description = 'A Ruby library for text classification featuring Naive Bayes, LSI (Latent Semantic Indexing), ' \
'Logistic Regression, and k-Nearest Neighbors classifiers. Includes TF-IDF vectorization, ' \
Expand All @@ -16,7 +18,9 @@ Gem::Specification.new do |s|
'changelog_uri' => 'https://github.com/cardmagic/classifier/releases'
}
s.required_ruby_version = '>= 3.1'
s.files = Dir['{lib,sig}/**/*.{rb,rbs}', 'ext/**/*.{c,h,rb}', 'bin/*', 'LICENSE', '*.md', 'test/*']
s.files = Dir['{lib,sig,exe}/**/*.{rb,rbs}', 'ext/**/*.{c,h,rb}', 'exe/*', 'bin/*', 'LICENSE', '*.md', 'test/*']
s.bindir = 'exe'
s.executables = ['classifier']
s.extensions = ['ext/classifier/extconf.rb']
s.license = 'LGPL'

Expand Down
9 changes: 9 additions & 0 deletions exe/classifier
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env ruby
require 'classifier/cli'

result = Classifier::CLI.new(ARGV).run

warn result[:error] unless result[:error].empty?
puts result[:output] unless result[:output].empty?

exit result[:exit_code]
1 change: 1 addition & 0 deletions lib/classifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# License:: LGPL

require 'rubygems'
require 'classifier/version'
require 'classifier/errors'
require 'classifier/storage'
require 'classifier/streaming'
Expand Down
Loading
Loading