Module: WordsCounted::Deprecated
- Included in:
- Counter
- Defined in:
- lib/words_counted/deprecated.rb
Instance Method Summary collapse
-
#average_chars_per_word(precision = 2) ⇒ Object
deprecated
Deprecated.
use
Counter#average_chars_per_token
-
#count(token) ⇒ Object
deprecated
Deprecated.
use
Counter#average_chars_per_token
-
#longest_words ⇒ Object
deprecated
Deprecated.
use
Counter#longest_tokens
-
#most_occurring_words ⇒ Object
deprecated
Deprecated.
use
Counter#most_frequent_tokens
-
#sorted_word_lengths ⇒ Object
deprecated
Deprecated.
use
Counter#token_lengths
-
#sorted_word_occurrences ⇒ Object
deprecated
Deprecated.
use
Counter#token_frequency
-
#unique_word_count ⇒ Object
deprecated
Deprecated.
use
Counter#uniq_token_count
-
#word_count ⇒ Object
deprecated
Deprecated.
use
Counter#token_count
-
#word_density(precision = 2) ⇒ Object
deprecated
Deprecated.
use
Counter#token_density
-
#word_lengths ⇒ Object
deprecated
Deprecated.
use
Counter#token_lengths
-
#word_occurrences ⇒ Object
deprecated
Deprecated.
use
Counter#token_frequency
Instance Method Details
#average_chars_per_word(precision = 2) ⇒ Object
Deprecated.
use Counter#average_chars_per_token
67 68 69 70 |
# File 'lib/words_counted/deprecated.rb', line 67 def average_chars_per_word(precision = 2) warn "`Counter#average_chars_per_word` is deprecated, please use `Counter#average_chars_per_token`" average_chars_per_token(precision: precision) end |
#count(token) ⇒ Object
Deprecated.
use Counter#average_chars_per_token
73 74 75 76 |
# File 'lib/words_counted/deprecated.rb', line 73 def count(token) warn "`Counter#count` is deprecated, please use `Array#count`" tokens.count(token.downcase) end |
#longest_words ⇒ Object
Deprecated.
use Counter#longest_tokens
60 61 62 63 64 |
# File 'lib/words_counted/deprecated.rb', line 60 def longest_words warn "`Counter#longest_words` is deprecated, please use `Counter#longest_tokens`" warn "`Counter#longest_tokens` returns a hash, not an array. Call `longest_tokens.to_h` for old behaviour." longest_tokens.to_a end |
#most_occurring_words ⇒ Object
Deprecated.
use Counter#most_frequent_tokens
53 54 55 56 57 |
# File 'lib/words_counted/deprecated.rb', line 53 def most_occurring_words warn "`Counter#most_occurring_words` is deprecated, please use `Counter#most_frequent_tokens`" warn "`Counter#most_frequent_tokens` returns a hash, not an array. Call `most_frequent_tokens.to_h` for old behaviour." most_frequent_tokens.to_a end |
#sorted_word_lengths ⇒ Object
Deprecated.
use Counter#token_lengths
47 48 49 50 |
# File 'lib/words_counted/deprecated.rb', line 47 def sorted_word_lengths warn "`Counter#sorted_word_lengths` is deprecated, please use `Counter#token_lengths`" token_lengths end |
#sorted_word_occurrences ⇒ Object
Deprecated.
use Counter#token_frequency
41 42 43 44 |
# File 'lib/words_counted/deprecated.rb', line 41 def sorted_word_occurrences warn "`Counter#sorted_word_occurrences` is deprecated, please use `Counter#token_frequency`" token_frequency end |
#unique_word_count ⇒ Object
Deprecated.
use Counter#uniq_token_count
13 14 15 16 |
# File 'lib/words_counted/deprecated.rb', line 13 def unique_word_count warn "`Counter#unique_word_count` is deprecated, please use `Counter#uniq_token_count`" uniq_token_count end |
#word_count ⇒ Object
Deprecated.
use Counter#token_count
7 8 9 10 |
# File 'lib/words_counted/deprecated.rb', line 7 def word_count warn "`Counter#word_count` is deprecated, please use `Counter#token_count`" token_count end |
#word_density(precision = 2) ⇒ Object
Deprecated.
use Counter#token_density
33 34 35 36 37 38 |
# File 'lib/words_counted/deprecated.rb', line 33 def word_density(precision = 2) warn "`Counter#word_density` is deprecated, please use `Counter#token_density`" warn "`Counter#token_density` returns density as decimal and not percent" token_density(precision: precision * 2).map { |tuple| [tuple.first, (tuple.last * 100).round(precision)] } end |
#word_lengths ⇒ Object
Deprecated.
use Counter#token_lengths
26 27 28 29 30 |
# File 'lib/words_counted/deprecated.rb', line 26 def word_lengths warn "`Counter#word_lengths` is deprecated, please use `Counter#token_lengths`" warn "`Counter#token_lengths` returns a sorted array of arrays, not a hash. Call `token_lengths.to_h` for old behaviour" token_lengths.to_h end |
#word_occurrences ⇒ Object
Deprecated.
use Counter#token_frequency
19 20 21 22 23 |
# File 'lib/words_counted/deprecated.rb', line 19 def word_occurrences warn "`Counter#word_occurrences` is deprecated, please use `Counter#token_frequency`" warn "`Counter#token_frequency` returns a sorted array of arrays, not a hash. Call `token_frequency.to_h` for old behaviour" token_frequency.to_h end |