blib/lib/Lingua/Ogmios/LearningDataSet/Attribute.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 86 SCAR 42.8
CC
8
Cov
0%
index
6.0
name
6.0
prefix
6.0
CRAP 72.0
1 package Lingua::Ogmios::LearningDataSet::Attribute;
2  
3 use strict;
4 use warnings;
5  
6 our $VERSION='0.1';
7  
8 sub new {
9 my $class = shift;
10 my $fields = shift;
11  
12 my $attribute = {
13 'index' => -1,
14 'name' => $fields->{name},
15 'prefix' => $fields->{prefix},
16 'type' => $fields->{type},
17 'weight' => $fields->{weight},
18 'comment' => $fields->{comment},
19 'value' => $fields->{value},
20 };
21  
22 bless($attribute, $class);
23
24 # $attribute->set_subname;
25  
26 return($attribute);
27 }
28  
29 sub index {
30 my $self = shift;
31  
32 if (@_) {
33 $self->{'index'} = shift;
34 }
35 return($self->{'index'});
36 }
37  
38 # sub set_subname {
39 # my ($self) = @_;
40  
41 # $self->{'subname'} = $self->{'name'};
42 # $self->{'subname'} =~ s/^$self->{'weight'}//;
43  
44 # return($self->{'subname'});
45  
46 # }
47  
48 sub value {
49 my ($self) = @_;
50  
51 return($self->{'value'});
52  
53 }
54  
55 sub name {
56 my $self = shift;
57  
58 if (@_) {
59 $self->{'name'} = shift;
60 }
61 return($self->{'name'});
62 }
63  
64 sub prefix {
65 my $self = shift;
66  
67 if (@_) {
68 $self->{'prefix'} = shift;
69 }
70 return($self->{'prefix'});
71 }
72  
73 sub comment {
74 my $self = shift;
75  
76 if (@_) {
77 $self->{'comment'} = shift;
78 }
79 return($self->{'comment'});
80 }
81  
82 sub type {
83 my $self = shift;
84  
85 if (@_) {
86 $self->{'type'} = shift;
87 }
88 return($self->{'type'});
89 }
90  
91 sub weight {
92 my $self = shift;
93  
94 if (@_) {
95 $self->{'weight'} = shift;
96 }
97 return($self->{'weight'});
98 }
99  
100 sub getARFF {
101 my $self = shift;
102  
103 my $arffString;
104  
105 $arffString = "% " . $self->comment . "\n";
106 $arffString .= '@ATTRIBUTE ' . $self->name . " ";
107 if (ref($self->type) eq "ARRAY") {
108 $arffString .= '{'. join(",", @{$self->type}) . '}';
109 } else {
110 $arffString .= $self->type;
111 }
112  
113 # if (defined $self->weight) {
114
115 # }
116 return($arffString);
117
118 }
119  
120 sub getSVM {
121 my $self = shift;
122  
123 return("");
124 }
125  
126 =head1 NAME
127  
128 Lingua::Ogmios::LearningDataSet::Attribute - Perl extension for ???.
129  
130 =head1 SYNOPSIS
131  
132 use Lingua::Ogmios::LearningDataSet::Attribute;
133  
134 my %config = Lingua::Ogmios::LearningDataSet::Attribute::load_config($rcfile);
135  
136 $yatea = Lingua::Ogmios::LearningDataSet::Attribute->new($config{"OPTIONS"}, \%config);
137  
138 $yatea->termExtraction($corpus);
139  
140  
141 =head1 DESCRIPTION
142  
143  
144 =head1 METHODS
145  
146 =head2 function()
147  
148 function($rcfile);
149  
150 =head1 SEE ALSO
151  
152  
153 =head1 AUTHORS
154  
155 Thierry Hamon <thierry.hamon@limsi.fr>
156  
157 =head1 LICENSE
158  
159 Copyright (C) 2013 by Thierry Hamon
160  
161 This library is free software; you can redistribute it and/or modify
162 it under the same terms as Perl itself, either Perl version 5.8.6 or,
163 at your option, any later version of Perl 5 you may have available.
164  
165  
166 =cut
167  
168  
169 1;