lib/unicoder/replace_common_words.rb in unicoder-1.1.0 vs lib/unicoder/replace_common_words.rb in unicoder-1.1.1

- old
+ new

@@ -1,10 +1,11 @@ require "json" module Unicoder module ReplaceCommonWords - def replace_common_words!(which_index, words, count = 500, base = ?[.ord, min_word_length = 4) - puts "Starting to replace the #{count} most common words" + def replace_common_words!(which_index, words, count = 500, _ = ?[.ord, min_word_length = 4) + base = @words.join.chars.max.ord + 1 + puts "Starting to replace the #{count} most common words (replace base: #{base})" @index[:REPLACE_BASE] = base @index[:COMMON_WORDS] = words. select{_1.size >= min_word_length}. tally. max_by(count){_2}. \ No newline at end of file