lib/linnaeus/persistence.rb
# Clean out words with a count of zero in a category. Used during untraining.
#
# == Parameters
# category::
#   A string representing a category.
Clean out words with a count of zero in a category. Used during untraining.
Parameters
category::
A string representing a category.
Clean out words with a count of zero in a category . Used during untraining . Parameters category :: A string representing a category .
def cleanup_empty_words_in_category(category)
    word_counts = @redis.hgetall base_category_key + category
    empty_words = word_counts.select{|word, count| count.to_i <= 0}
    if empty_words == word_counts
      @redis.del base_category_key + category
    else
      if empty_words.any?
        @redis.hdel base_category_key + category, empty_words.keys
      end
    end
  end
def cleanup_empty_words_in_category ( category ) word_counts = @redis . hgetall base_category_key + category empty_words = word_counts . select { | word , count | count . to_i <= 0 } if empty_words == word_counts @redis . del base_category_key + category else if empty_words . any? @redis . hdel base_category_key + category , empty_words . keys end end end
Clean out words with a count of zero in a category.
Clean out words with a count of zero in a category .
category
<not_specific>