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
65 66 67 68 |
# File 'lib/words_counted/deprecated.rb', line 65 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
71 72 73 74 |
# File 'lib/words_counted/deprecated.rb', line 71 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
58 59 60 61 62 |
# File 'lib/words_counted/deprecated.rb', line 58 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
51 52 53 54 55 |
# File 'lib/words_counted/deprecated.rb', line 51 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
45 46 47 48 |
# File 'lib/words_counted/deprecated.rb', line 45 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
39 40 41 42 |
# File 'lib/words_counted/deprecated.rb', line 39 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
11 12 13 14 |
# File 'lib/words_counted/deprecated.rb', line 11 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
5 6 7 8 |
# File 'lib/words_counted/deprecated.rb', line 5 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
31 32 33 34 35 36 |
# File 'lib/words_counted/deprecated.rb', line 31 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
24 25 26 27 28 |
# File 'lib/words_counted/deprecated.rb', line 24 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
17 18 19 20 21 |
# File 'lib/words_counted/deprecated.rb', line 17 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 |