words_counted 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/lib/words_counted/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f61a698d9d17731d259b713c3757349b0903423b
|
4
|
+
data.tar.gz: fee5634244f3acc3b2b63ec8743dda47b8fae9f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8db533544c8c94bb563ea68118b2c46b9b44d05567e0bef9904ecc2cf21655dc10ea2fe98385bd86b5bde6c81343adce6cbf5400f7f94b7daa799c103f20251
|
7
|
+
data.tar.gz: a06af98468823d3dd6bb6af1e41939f0ee47a5acc4e8536dbd8a15869fb548d3f4b0cf101ec05ded0c70e68ba9dca3fe62466823e99e089b2dcf5acd28fc22ef
|
data/README.md
CHANGED
@@ -164,7 +164,9 @@ counter.word_density
|
|
164
164
|
You can pass in a space-delimited word list to filter words that you don't want to count. Filter words should be *lowercase*. The filter will remove both uppercase and lowercase variants of the word.
|
165
165
|
|
166
166
|
```ruby
|
167
|
-
WordsCounted::Counter.new(
|
167
|
+
WordsCounted::Counter.new(
|
168
|
+
"Magnificent! That was magnificent, Trevor.", filter: "was magnificent"
|
169
|
+
)
|
168
170
|
counter.words
|
169
171
|
#=> ["That", "Trevor"]
|
170
172
|
```
|
@@ -182,7 +184,7 @@ If you prefer, you can pass in your own criteria in the form of a Ruby regexp to
|
|
182
184
|
```ruby
|
183
185
|
counter = WordsCounted::Counter.new("I am 007.", regex: /[^\p{Alnum}\-']+/)
|
184
186
|
counter.words
|
185
|
-
|
187
|
+
#=> ["I", "am", "007"]
|
186
188
|
```
|
187
189
|
|
188
190
|
## Gotchas
|
@@ -211,7 +213,9 @@ counter.word_occurrences
|
|
211
213
|
|
212
214
|
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.
|
213
215
|
|
214
|
-
|
216
|
+
Another gotcha is that the default criteria does not count numbers as words.
|
217
|
+
|
218
|
+
Remember that you can pass in your own regexp if the default solution does not fit your needs.
|
215
219
|
|
216
220
|
## To do
|
217
221
|
|
@@ -240,7 +244,7 @@ end
|
|
240
244
|
|
241
245
|
#### Isn't it better to write this in JavaScript?
|
242
246
|
|
243
|
-

|
244
248
|
|
245
249
|
## About
|
246
250
|
|