1AI::Categorizer::CategoUrsye(r3pCmo)ntributed Perl DocumAeIn:t:aCtaitoengorizer::Category(3pm)
2
3
4
6 AI::Categorizer::Category - A named category of documents
7
9 my $category = AI::Categorizer::Category->by_name("sports");
10 my $name = $category->name;
11
12 my @docs = $category->documents;
13 my $num_docs = $category->documents;
14 my $features = $category->features;
15
16 $category->add_document($doc);
17 if ($category->contains_document($doc)) { ...
18
20 This simple class represents a named category which may contain zero or
21 more documents. Each category is a "singleton" by name, so two
22 Category objects with the same name should not be created at once.
23
25 new()
26 Creates a new Category object and returns it. Accepts the
27 following parameters:
28
29 name
30 The name of this category
31
32 documents
33 A reference to an array of Document objects that should belong
34 to this category.
35
36 by_name(name => $string)
37 Returns the Category object with the given name, or creates one if
38 no such object exists.
39
40 documents()
41 Returns a list of the Document objects in this category in a list
42 context, or the number of such objects in a scalar context.
43
44 features()
45 Returns a FeatureVector object representing the sum of all the
46 FeatureVectors of the Documents in this Category.
47
48 add_document($document)
49 Informs the Category that the given Document belongs to it.
50
51 contains_document($document)
52 Returns true if the given document belongs to this category, or
53 false otherwise.
54
56 Ken Williams, ken@mathforum.org
57
59 Copyright 2000-2003 Ken Williams. All rights reserved.
60
61 This library is free software; you can redistribute it and/or modify it
62 under the same terms as Perl itself.
63
65 AI::Categorizer(3), Storable(3)
66
67
68
69perl v5.38.0 2023-07-20 AI::Categorizer::Category(3pm)