text_parser 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,4 +3,5 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - 1.9.3
6
- script: "rake test"
6
+ - 2.0.0
7
+ script: "rake test"
@@ -1,3 +1,3 @@
1
1
  module TextParser
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -5,9 +5,9 @@ require "text_parser"
5
5
  class TextParserTest < Test::Unit::TestCase
6
6
 
7
7
  def test_should_have_method_parse
8
- assert "some text".methods.select{|a| a.to_s == "parse"}.count > 0
8
+ assert "string".respond_to?(:parse)
9
9
  end
10
-
10
+
11
11
  def test_should_parse
12
12
  text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pretium consectetur."
13
13
  assert_equal [{:word => "consectetur", :hits => 2},
@@ -23,14 +23,14 @@ class TextParserTest < Test::Unit::TestCase
23
23
  text = "Test? Test. Yes, test!"
24
24
  assert_equal [{:word => "test", :hits => 3}, {:word => "yes", :hits => 1}], text.parse
25
25
  end
26
-
26
+
27
27
  def test_should_return_an_empty_array
28
28
  assert_equal "test".parse(:dictionary => ['abc']), []
29
29
  end
30
30
 
31
31
  def test_should_order_by_word_asc
32
32
  text = " beta omega gamma alpha gamma"
33
- result = [{:word => "alpha", :hits => 1},
33
+ result = [{:word => "alpha", :hits => 1},
34
34
  {:word => "beta", :hits => 1},
35
35
  {:word => "gamma", :hits => 2},
36
36
  {:word => "omega", :hits => 1}]
@@ -38,12 +38,12 @@ class TextParserTest < Test::Unit::TestCase
38
38
  assert_equal result, text.parse(:order => :word)
39
39
  assert_equal result, text.parse(:order => :word, :order_direction => :asc)
40
40
  end
41
-
41
+
42
42
  def test_should_order_by_word_desc
43
43
  assert_equal [{:word => "zzz", :hits => 1},
44
44
  {:word => "aaa", :hits => 1}], "aaa zzz".parse(:order => :word, :order_direction => :desc)
45
45
  end
46
-
46
+
47
47
  def test_should_order_by_hits_asc
48
48
  text = "gamma alpha gamma beta alpha gamma"
49
49
  result = [{:word => "beta", :hits => 1},
@@ -52,7 +52,7 @@ class TextParserTest < Test::Unit::TestCase
52
52
  assert_equal result, text.parse(:order => :hits)
53
53
  assert_equal result, text.parse(:order => :hits, :order_direction => :asc)
54
54
  end
55
-
55
+
56
56
  def test_should_order_by_hits_desc
57
57
  text = "gamma alpha gamma beta alpha gamma"
58
58
  assert_equal [{:word => "gamma", :hits => 3},
@@ -60,7 +60,7 @@ class TextParserTest < Test::Unit::TestCase
60
60
  {:word => "beta", :hits => 1}],
61
61
  text.parse(:order => :hits, :order_direction => :desc)
62
62
  end
63
-
63
+
64
64
  def test_should_ignore_negative_dictionary
65
65
  assert_equal [{:word => "good", :hits => 1}], "This is good".parse(:negative_dictionary => ["is", "this"])
66
66
  end
@@ -68,11 +68,11 @@ class TextParserTest < Test::Unit::TestCase
68
68
  def test_should_works_with_special_characters
69
69
  assert_equal [], "*&%?!$#%$@\\'///[.](\")".parse
70
70
  end
71
-
71
+
72
72
  def test_should_works_hifen
73
73
  assert_equal [{:word => "self-service", :hits => 1}], "self-service".parse
74
74
  end
75
-
75
+
76
76
  def test_should_return_double_words
77
77
  assert_equal [{:word => "forrest gump", :hits => 1}],
78
78
  "I like the movie Forrest Gump.".parse(:dictionary => ["Forrest Gump"])
@@ -91,7 +91,7 @@ class TextParserTest < Test::Unit::TestCase
91
91
  {:word => "espacos",:hits => 1},
92
92
  {:word => "eu", :hits => 1},
93
93
  {:word => "se", :hits => 1}], text.parse
94
- end
94
+ end
95
95
 
96
96
  def test_should_keep_some_special_character
97
97
  assert_equal [{:word => "espaço", :hits => 1},
@@ -100,7 +100,7 @@ class TextParserTest < Test::Unit::TestCase
100
100
  {:word => "pão", :hits => 1}], "Pão açúcar".parse
101
101
  assert_equal [{:word => "ãéç", :hits => 1}], "ãéç".parse
102
102
  end
103
-
103
+
104
104
  def test_minimum_length
105
105
  text = "a ab abc "
106
106
  assert_equal [{:word => "a", :hits => 1},
@@ -112,18 +112,4 @@ class TextParserTest < Test::Unit::TestCase
112
112
  assert_equal [{:word => "abc", :hits => 1}], text.parse(:minimum_length => 2, :negative_dictionary => ["ab"])
113
113
  assert_equal [], text.parse(:minimum_length => 3, :dictionary => ["a"])
114
114
  end
115
- end
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
115
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 9
10
- version: 0.1.9
9
+ - 10
10
+ version: 0.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Frederico de Paula
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-23 00:00:00 Z
18
+ date: 2013-05-22 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Includes a parse method on String object
@@ -93,3 +93,4 @@ specification_version: 3
93
93
  summary: Using method parse in the String object you can parse any text.
94
94
  test_files:
95
95
  - test/text_parser_test.rb
96
+ has_rdoc: