- Adds support for Ruby 3.0.0.
- Improve documentation and adds newer configs to Travis CI and Hound.
This version brings lots of improvements to code organisation. The tokeniser has been extracted into its own class. All methods in Counter
have either renamed or deprecated. Deprecated methods and their tests have moved into their own modules. Using them will trigger warnings with upgrade instructions outlined below.
- Extracted tokenisation behaviour from
Counter
into aTokeniser
class. - Deprecated all methods that have
word
in their name. Most are renamed such thatword
becametoken
. They will be removed in version 1.1.
- Deprecated
word_count
in favor oftoken_count
- Deprecated
unique_word_count
in favor ofunique_token_count
- Deprecated
word_occurrences
andsorted_word_occurrences
in favor oftoken_frequency
- Deprecated
word_lengths
andsorted_word_lengths
in favor oftoken_lenghts
- Deprecated
word_density
in favor oftoken_density
- Deprecated
most_occurring_words
in favor ofmost_frequent_tokens
- Deprecated
longest_words
in favor oflongest_tokens
- Deprecated
average_chars_per_word
in favor ofaverage_chars_per_token
- Deprecated
count
. UseArray#count
instead.
token_lengths
, which replacesword_lengths
returns a sorted two-dimensional array instead of a hash. It behaves exactly likesorted_word_lengths
which has been deprecated. Usetoken_lengths.to_h
for old behaviour.token_frequency
, which replacesword_occurences
returns a sorted two-dimensional array instead of a hash. It behaves likesorted_word_occurrences
which has been deprecated. Usetoken_frequency.to_h
for old behaviour.token_density
, which replacesword_density
, returns a decimal with a precision of 2, not a percent. Usetoken_density * 100
for old behaviour.- Add a refinement to Hash under
lib/refinements/hash_refinements.rb
to quickly sort by descending value. - Extracted all deprecated methods to their own module, and their tests to their own spec file.
- Added a base
words_counted_spec.rb
and moved.from_file
test to the new file. - Added Travis continuous integration.
- Add documentation to the code.
- Removed
to_f
from the dividend inaverage_chars_per_word
andword_densities
. The divisor is a float, and dividing by a float returns a float. - Added
# -*- encoding : utf-8 -*-
to all files. See pull request. - Added this changelog.