Skip to content

Commit 9d67f4e

Browse files
committed
style: safe-auto-correct Layout cops
1 parent 648bec4 commit 9d67f4e

File tree

17 files changed

+56
-36
lines changed

17 files changed

+56
-36
lines changed

lib/classifier-reborn.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@
3636
require_relative 'classifier-reborn/category_namer'
3737
require_relative 'classifier-reborn/bayes'
3838
require_relative 'classifier-reborn/lsi'
39-
require_relative 'classifier-reborn/validators/classifier_validator'
39+
require_relative 'classifier-reborn/validators/classifier_validator'

lib/classifier-reborn/backends/bayes_memory_backend.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def reset
6969
private
7070

7171
def category_counts(category)
72-
@category_counts[category] ||= {training: 0, word: 0}
72+
@category_counts[category] ||= { training: 0, word: 0 }
7373
end
7474
end
7575
end

lib/classifier-reborn/bayes.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ class Bayes
2929
# backend: BayesMemoryBackend.new Alternatively, BayesRedisBackend.new for persistent storage
3030
def initialize(*args)
3131
@initial_categories = []
32-
options = { language: 'en',
32+
options = { language: 'en',
3333
enable_threshold: false,
34-
threshold: 0.0,
35-
enable_stemmer: true,
36-
backend: BayesMemoryBackend.new
37-
}
34+
threshold: 0.0,
35+
enable_stemmer: true,
36+
backend: BayesMemoryBackend.new }
3837
args.flatten.each do |arg|
3938
if arg.is_a?(Hash)
4039
options.merge!(arg)
@@ -79,6 +78,7 @@ def train(category, text)
7978
word_hash = Hasher.word_hash(text, @enable_stemmer,
8079
tokenizer: @tokenizer, token_filters: @token_filters)
8180
return if word_hash.empty?
81+
8282
category = CategoryNamer.prepare_name(category)
8383

8484
# Add the category dynamically or raise an error
@@ -110,9 +110,11 @@ def untrain(category, text)
110110
word_hash = Hasher.word_hash(text, @enable_stemmer,
111111
tokenizer: @tokenizer, token_filters: @token_filters)
112112
return if word_hash.empty?
113+
113114
category = CategoryNamer.prepare_name(category)
114115
word_hash.each do |word, count|
115116
next if @backend.total_words < 0
117+
116118
orig = @backend.category_word_frequency(category, word) || 0
117119
@backend.update_category_word_frequency(category, word, -count)
118120
if @backend.category_word_frequency(category, word) <= 0

lib/classifier-reborn/extensions/hasher.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
23
# Author:: Lucas Carlson (mailto:lucas@rufy.com)
34
# Copyright:: Copyright (c) 2005 Lucas Carlson
45
# License:: LGPL

lib/classifier-reborn/extensions/token_filter/stemmer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
23
# Author:: Lucas Carlson (mailto:lucas@rufy.com)
34
# Copyright:: Copyright (c) 2005 Lucas Carlson
45
# License:: LGPL

lib/classifier-reborn/extensions/token_filter/stopword.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
23
# Author:: Lucas Carlson (mailto:lucas@rufy.com)
34
# Copyright:: Copyright (c) 2005 Lucas Carlson
45
# License:: LGPL

lib/classifier-reborn/extensions/token_filter/symbol.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
23
# Author:: Lucas Carlson (mailto:lucas@rufy.com)
34
# Copyright:: Copyright (c) 2005 Lucas Carlson
45
# License:: LGPL

lib/classifier-reborn/extensions/tokenizer/token.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
23
# Author:: Lucas Carlson (mailto:lucas@rufy.com)
34
# Copyright:: Copyright (c) 2005 Lucas Carlson
45
# License:: LGPL

lib/classifier-reborn/extensions/tokenizer/whitespace.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
23
# Author:: Lucas Carlson (mailto:lucas@rufy.com)
34
# Copyright:: Copyright (c) 2005 Lucas Carlson
45
# License:: LGPL
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Vector
22
def zero?
3-
self.all? {|_| _ == 0}
3+
self.all? { |_| _ == 0 }
44
end
55
end

0 commit comments

Comments
 (0)