1AI::Categorizer(3pm)  User Contributed Perl Documentation AI::Categorizer(3pm)
2
3
4

NAME

6       AI::Categorizer - Automatic Text Categorization
7

SYNOPSIS

9        use AI::Categorizer;
10        my $c = new AI::Categorizer(...parameters...);
11
12        # Run a complete experiment - training on a corpus, testing on a test
13        # set, printing a summary of results to STDOUT
14        $c->run_experiment;
15
16        # Or, run the parts of $c->run_experiment separately
17        $c->scan_features;
18        $c->read_training_set;
19        $c->train;
20        $c->evaluate_test_set;
21        print $c->stats_table;
22
23        # After training, use the Learner for categorization
24        my $l = $c->learner;
25        while (...) {
26          my $d = ...create a document...
27          my $hypothesis = $l->categorize($d);  # An AI::Categorizer::Hypothesis object
28          print "Assigned categories: ", join ', ', $hypothesis->categories, "\n";
29          print "Best category: ", $hypothesis->best_category, "\n";
30        }
31

DESCRIPTION

33       "AI::Categorizer" is a framework for automatic text categorization.  It
34       consists of a collection of Perl modules that implement common
35       categorization tasks, and a set of defined relationships among those
36       modules.  The various details are flexible - for example, you can
37       choose what categorization algorithm to use, what features (words or
38       otherwise) of the documents should be used (or how to automatically
39       choose these features), what format the documents are in, and so on.
40
41       The basic process of using this module will typically involve obtaining
42       a collection of pre-categorized documents, creating a "knowledge set"
43       representation of those documents, training a categorizer on that
44       knowledge set, and saving the trained categorizer for later use.  There
45       are several ways to carry out this process.  The top-level
46       "AI::Categorizer" module provides an umbrella class for high-level
47       operations, or you may use the interfaces of the individual classes in
48       the framework.
49
50       A simple sample script that reads a training corpus, trains a
51       categorizer, and tests the categorizer on a test corpus, is distributed
52       as eg/demo.pl .
53
54       Disclaimer: the results of any of the machine learning algorithms are
55       far from infallible (close to fallible?).  Categorization of documents
56       is often a difficult task even for humans well-trained in the
57       particular domain of knowledge, and there are many things a human would
58       consider that none of these algorithms consider.  These are only
59       statistical tests - at best they are neat tricks or helpful assistants,
60       and at worst they are totally unreliable.  If you plan to use this
61       module for anything really important, human supervision is essential,
62       both of the categorization process and the final results.
63
64       For the usage details, please see the documentation of each individual
65       module.
66

FRAMEWORK COMPONENTS

68       This section explains the major pieces of the "AI::Categorizer" object
6