The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Freq::Node - Represents a node of the result tree constructed by Data::Freq

METHODS

new

Usage:

    my $root_node = Data::Freq::Node->new();

Constructs a node object in the "frequency tree" in Data::Freq.

add_subnode

Usage:

    my $child_node = $parent_node->add_subnode('normalized text');

Adds a normalized value and returns the corresponding subnode.

If the normalized text appears for the first time under the parent node, a new node is created. Otherwise, the existing node is returned with its count incremented by 1.

count

Retrieves the count for the normalized text.

value

Retrieves the normalized value.

parent

Retrieves the parent node in the "frequency tree" in Data::Freq.

For the root node, undef is returned.

children

Retrieves a hash ref of the raw counting results under this node, where the key is the normalized text and the value is the corresponding subnode.

unique

Retrieves the number of the child nodes.

max

Calculates the maximum count of the child nodes.

min

Calculates the minimum count of the child nodes.

average

Calculates the average count of the child nodes.

first

Retrieves the first occurrence index of this node under its parent node.

The index is the count of the parent node at the time this child node is created.

last

Retrieves the last occurrence index of this node under its parent node.

The index is the count of the parent node at the last time this child node is added or created.

depth

Retrieves the depth in the "frequency tree" in Data::Freq.

The depth of the root node is 0.

AUTHOR

Mahiro Ando, <mahiro at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2012 Mahiro Ando.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.