AI-Classifier

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19xx name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License.  Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here a sample; alter the names:

META.json  view on Meta::CPAN

      "test" : {
         "requires" : {
            "Data::Dumper" : "0",
            "Test::More" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "repository" : {
         "type" : "git",
         "web" : "http://github.com/operasoftware/AI-Classifier"
      }
   },
   "version" : "0.03"
}

dist.ini  view on Meta::CPAN

AI::NaiveBayes = 0.01
[TestRelease]
[PkgVersion]
[MetaNoIndex]
directory = t/lib
directory = examples
[InstallGuide]
[MetaJSON]
[MetaResources]
repository.web   = http://github.com/operasoftware/AI-Classifier
repository.type  = git

[NextRelease]
format = %-9v %{yyyy-MM-dd}d
[CheckChangeLog]
[PodSyntaxTests]
[PodCoverageTests]
[PodWeaver]

lib/AI/Classifier/Text/FileLearner.pm  view on Meta::CPAN

        when ('n') {
            my $max_tf = max values %$f;
            $_ = 0.5 + 0.5 * $_ / $max_tf for values %$f;
        }
        when ('b') {
            $_ = $_ ? 1 : 0 for values %$f;
        }
        when (undef){
        }
        default {
            croak 'Unknown weighting type: '.$self->term_weighting;
        }
    }
}

# this doesn't quite fit the current model (it requires the entire collection
# of documents to be in memory at once), but it may be useful to someone, someday
# so let's just leave it here
sub collection_weighting {
    my (@documents, $subtrahend) = @_;
    $subtrahend //= 0;



( run in 0.770 second using v1.01-cache-2.11-cpan-df04353d9ac )