cardmagic / classifier

A general classifier module to allow Bayesian and LSI classifications.
Other
661 stars 122 forks source link

Add remove_category functionality to Bayes classifier #39

Closed cardmagic closed 4 months ago

cardmagic commented 4 months ago

Changes Overview

These changes primarily focus on updating the Classifier gem, specifically enhancing the Bayesian classifier functionality. The main modifications include:

  1. Incrementing the gem version from 1.4.0 to 1.4.1.
  2. Adding a new remove_category method to the Bayesian classifier.
  3. Implementing comprehensive tests for the new remove_category functionality.

Reason for Changes

The changes aim to provide users with more control over the Bayesian classifier by allowing them to remove categories. This feature can be useful in scenarios where categories become obsolete or need to be restructured.

Detailed Description

  1. Version Update - The gem version has been incremented from 1.4.0 to 1.4.1 in the gemspec file. This indicates a minor update with backward-compatible changes.

  2. New remove_category Method - A new method has been added to the Bayesian classifier that allows users to remove a category. This method:

    • Checks if the category exists.
    • Removes the category from various internal data structures.
    • Updates the total word count.
  3. Comprehensive Testing - Several new tests have been added to verify the functionality of the remove_category method. These tests cover various scenarios including:

    • Basic category removal
    • Attempting to remove a non-existent category
    • The effect of category removal on classification
    • Removing all categories
    • Removing and adding categories
    • Preserving data for other categories after removal