classyfier 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,12 +8,14 @@ module Classyfier
8
8
  @english_dict = load_dictionary()
9
9
  end
10
10
 
11
- def classify(text)
11
+ def classify(text, opts = {:word_count => 1})
12
12
  words = text.split(" ")
13
+ count = 0
13
14
  for word in words
14
- return true if @english_dict[clean_word(word)]
15
+ count += 1 if @english_dict[clean_word(word)]
16
+ break if count >= opts[:word_count]
15
17
  end
16
- return false
18
+ return count >= opts[:word_count]
17
19
  end
18
20
 
19
21
  protected
@@ -1,3 +1,3 @@
1
1
  module Classyfier
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classyfier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: