classyfier 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/classyfier/english.rb +5 -3
- data/lib/classyfier/version.rb +1 -1
- metadata +1 -1
data/lib/classyfier/english.rb
CHANGED
@@ -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
|
-
|
15
|
+
count += 1 if @english_dict[clean_word(word)]
|
16
|
+
break if count >= opts[:word_count]
|
15
17
|
end
|
16
|
-
return
|
18
|
+
return count >= opts[:word_count]
|
17
19
|
end
|
18
20
|
|
19
21
|
protected
|
data/lib/classyfier/version.rb
CHANGED