words_counted 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d127f1d7ea83482f4efa3b8d25ff2154d6d8006
4
- data.tar.gz: 4e537850f5749aadf25f7ac435fbc141601b3425
3
+ metadata.gz: a74d7a0ee0210b034e5babbe9f90f11cd0c5db8b
4
+ data.tar.gz: f1852e2f1f728b7a22c519d43e670078edc61509
5
5
  SHA512:
6
- metadata.gz: 95adf80c2551fb0dd92fa260aad8b0b0eb62ddb11ced4b4a3afb70493782810c24919c84ce1b89b646c07ea34db7f94e3cd0515d10709d956139b87bd441c2be
7
- data.tar.gz: 2494524dc28161f2ca8d7ada896c7522ddb7266b9aac5ca50288b67298f8a0b1eb1460e027d60478c23c2fd220078ce02c98e2f0f977496723ae59d5aac4cf30
6
+ metadata.gz: b8edcbac512ac3edaf9dfc1a28a66e55e34e7ca33c9db57688c8c5658c0f5b514c1585316d7657389ce3ed40c1b91c0dd58aefca24c2c0b1d7ab91736cb30f80
7
+ data.tar.gz: 5019a1db7d42ef06068e24e666efe90f54bc7ac3821bbb9b2232506644712fa985592dfcdcf6a3310945ec940002a6b037665685aebcb645052262accb2ccd86
data/README.md CHANGED
@@ -52,21 +52,23 @@ Returns a hash map of words and their number of occurrences. Uppercase and lower
52
52
 
53
53
  ```ruby
54
54
  counter.word_occurrences
55
- #=> {
56
- "we"=>1,
57
- "are"=>2,
58
- "all"=>1,
59
- "in"=>1,
60
- "the"=>2,
61
- "gutter"=>1,
62
- "but"=>1,
63
- "some"=>1,
64
- "of"=>1,
65
- "us"=>1,
66
- "looking"=>1,
67
- "at"=>1,
68
- "stars"=>1
69
- }
55
+ #
56
+ # {
57
+ # "we" => 1,
58
+ # "are" => 2,
59
+ # "all" => 1,
60
+ # "in" => 1,
61
+ # "the" => 2,
62
+ # "gutter" => 1,
63
+ # "but" => 1,
64
+ # "some" => 1,
65
+ # "of" => 1,
66
+ # "us" => 1,
67
+ # "looking" => 1,
68
+ # "at" => 1,
69
+ # "stars" => 1
70
+ # }
71
+ #
70
72
  ```
71
73
 
72
74
  #### `.most_occurring_words`
@@ -75,11 +77,12 @@ Returns a two dimensional array of the most occurring word and its number of occ
75
77
 
76
78
  ```ruby
77
79
  counter.most_occurring_words
78
- #=>
79
- [
80
- ["are", 2],
81
- ["the", 2]
82
- ]
80
+ #
81
+ # [
82
+ # ["are", 2],
83
+ # ["the", 2]
84
+ # ]
85
+ #
83
86
  ```
84
87
 
85
88
  #### `.word_lengths`
@@ -88,21 +91,23 @@ Returns a hash of words and their lengths.
88
91
 
89
92
  ```ruby
90
93
  counter.word_lengths
91
- #=> {
92
- "We"=>2,
93
- "are"=>3,
94
- "all"=>3,
95
- "in"=>2,
96
- "the"=>3,
97
- "gutter"=>6,
98
- "but"=>3,
99
- "some"=>4,
100
- "of"=>2,
101
- "us"=>2,
102
- "looking"=>7,
103
- "at"=>2,
104
- "stars"=>5
105
- }
94
+ #
95
+ # {
96
+ # "We" => 2,
97
+ # "are" => 3,
98
+ # "all" => 3,
99
+ # "in" => 2,
100
+ # "the" => 3,
101
+ # "gutter" => 6,
102
+ # "but" => 3,
103
+ # "some" => 4,
104
+ # "of" => 2,
105
+ # "us" => 2,
106
+ # "looking" => 7,
107
+ # "at" => 2,
108
+ # "stars" => 5
109
+ # }
110
+ #
106
111
  ```
107
112
 
108
113
  #### `.longest_word`
@@ -111,9 +116,20 @@ Returns a two dimensional array of the longest word and its length. In case ther
111
116
 
112
117
  ```ruby
113
118
  counter.longest_words
114
- #=> [
115
- ["looking", 7]
116
- ]
119
+ #
120
+ # [
121
+ # ["looking", 7]
122
+ # ]
123
+ #
124
+ ```
125
+
126
+ #### `.words`
127
+
128
+ Returns an array of words resulting from the string passed into the initialize method.
129
+
130
+ ```ruby
131
+ counter.words
132
+ #=> ["We", "are", "all", "in", "the", "gutter", "but", "some", "of", "us", "are", "looking", "at", "the", "stars"]
117
133
  ```
118
134
 
119
135
  ## Filtering
@@ -134,17 +150,19 @@ counter = WordsCounted::Counter.new("How do you do?-you are well, I see.")
134
150
  #<WordsCounted::Counter:0x007fd494252518 @words=["How", "do", "you", "do", "-you", "are", "well", "I", "see"]>
135
151
 
136
152
  counter.word_occurrences
137
- #=> {
138
- "how"=>1,
139
- "do"=>2,
140
- "you"=>1,
141
- "-you"=>1, # WTF, mate!
142
- "are"=>1,
143
- "very"=>1,
144
- "well"=>1,
145
- "i"=>1,
146
- "see"=>1
147
- }
153
+ #
154
+ # {
155
+ # "how" => 1,
156
+ # "do" => 2,
157
+ # "you" => 1,
158
+ # "-you" => 1, # WTF, mate!
159
+ # "are" => 1,
160
+ # "very" => 1,
161
+ # "well" => 1,
162
+ # "i" => 1,
163
+ # "see" => 1
164
+ # }
165
+ #
148
166
  ```
149
167
 
150
168
  In this example, `-you` and `you` are counted as separate words. Writers should use the correct dash element, but this is not always the case.
@@ -68,6 +68,8 @@ module WordsCounted
68
68
  #
69
69
  # {http://codereview.stackexchange.com/a/47515/1563 See here}.
70
70
  #
71
+ # @param entries [Hash] a hash of entries to analyse
72
+ #
71
73
  def highest_ranking(entries)
72
74
  entries.group_by { |word, occurrence| occurrence }.sort.last.last
73
75
  end
@@ -1,3 +1,3 @@
1
1
  module WordsCounted
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: words_counted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamad El-Husseini