AI-Fuzzy

 view release on metacpan or  search on metacpan

lib/AI/Fuzzy/Axis.pm  view on Meta::CPAN

use AI::Fuzzy::Label;
## Container for Fuzzy Labels #### 

sub new {

    my ($class) = @_;
    my $self = {};

    $self->{labels} = {};

    bless $self, $class;
    return $self;
}

sub addlabel {
    # adds a label for a range of values..
    my ($self, $label, $low, $mid, $high) = @_;

    if ($label->can("name") ) {
	$self->{labels}->{$label->name} = $label;
    } else {

lib/AI/Fuzzy/Label.pm  view on Meta::CPAN

		'>=' => \&greaterequal,
		'<=' => \&lessequal,
		'<=>'=> \&spaceship,
		'""'  => \&stringify 
	    );

sub new {
    my ($class, $name, $low, $mid, $high) = @_;
    my $self = {};

    bless $self, $class;

    $self->{name} = $name;
    $self->{low}  = $low;
    $self->{mid}  = $mid;
    $self->{high} = $high;

    return $self;
}

sub name {

lib/AI/Fuzzy/Set.pm  view on Meta::CPAN


sub new { 

    my $class = shift;
    my $self = {} ;

    # accepts a hash of member weights..
    # ( $members{$member}=$weight )

    %{$self->{members}} = @_;
    bless $self, $class;
}

sub membership {
    # naturally, it returns a fuzzy value - the degree
    # to wich $item is a member of the set! :)

    my $self = shift;
    my $item = shift;

    if (defined(${$self->{members}}{$item})) {



( run in 0.850 second using v1.01-cache-2.11-cpan-de7293f3b23 )