« blib/lib/Lingua/Ogmios/LearningDataSet.pm
↑ Summary
blib/lib/Lingua/Ogmios/NLPWrappers/Template.pm »
| 1 | package Lingua::Ogmios::LearningDataSet::Data; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | our $VERSION='0.1'; | |||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 30 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 30 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 30 | my $fields = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | my $data = { | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 'values' => $fields->{values}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 'type' => $fields->{type}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 'weight' => $fields->{weight}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 'countVal' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 'class' => $fields->{class}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 'comment' => $fields->{comment}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 'qid' => $fields->{qid}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 30 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 30 | bless($data, $class); | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 30 | ▶ | if (!defined $data->type) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | $data->type('normal'); | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 30 | ▶ | if (defined $data->values) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $data->countVal(scalar(@{$data->values})); | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 30 | $data->{values} = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 30 | ▶ | if (defined $fields->{"countVal"}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 29 | $data->countVal($fields->{"countVal"}); | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 30 | return($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub weight { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
weight: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $self->{'weight'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return($self->{'weight'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 33 | ▶ | sub comment { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 33 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 33 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $self->{'comment'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 33 | return($self->{'comment'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 30 | ▶ | sub qid { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
qid: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 30 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->{'qid'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 30 | return($self->{'qid'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 124 | ▶ | sub class { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
class: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 124 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 124 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 29 | $self->{'class'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 124 | return($self->{'class'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | ▶ | sub isNormal { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isNormal: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | ▶ | if ($self->type eq "normal") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | return(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | return(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 455 | ▶ | sub isSparse { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isSparse: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 455 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 455 | ▶ | if ($self->type eq "sparse") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 453 | return(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | return(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 489 | ▶ | sub type { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 489 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 489 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | $self->{'type'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 489 | return($self->{'type'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1883 | ▶ | sub countVal { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
countVal: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 1883 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1883 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 31 | $self->{'countVal'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1883 | return($self->{'countVal'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2724 | ▶ | sub values { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
values: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2724 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2724 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | my $values_ref = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | push @{$self->{'values'}}, @$values_ref; | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | ▶ | if (defined $self->values) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | $self->countVal(scalar(@{$self->values})); | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 2724 | return($self->{'values'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | sub incr_value { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
incr_value: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $index = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if ($index >= $self->countVal) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | warn "\nindex ($index) out of range (countVal=" . $self->countVal . " - a)\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->values->[$index]++; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | return($self->values->[$index]); | |||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 427 | ▶ | sub value { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 427 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 427 | my $index = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 427 | ▶ | if ($index >= $self->countVal) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | warn "\nindex ($index) out of range (countVal=" . $self->countVal . " - b)\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 427 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 427 | $self->values->[$index] = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 427 | return($self->values->[$index]); | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | ▶ | sub getARFF { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getARFF: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | my $i; | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | 3 | my $arffString = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 3 | ▶ | if (defined $self->comment) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $arffString .= "% " . $self->comment . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | ▶ | if ($self->isNormal) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | $arffString .= join(',',@{$self->values}) . ","; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | ▶ | if (defined $self->class) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | $arffString .= $self->class; | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | $arffString .= "?" | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 3 | ▶ | if ($self->isSparse) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | $arffString .= '{'; | |||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | for($i=0;$i < $self->countVal;$i++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | ▶ | if (defined $self->values->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | #warn $self->values->[$i] . "($i)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | $arffString .= "$i " . $self->values->[$i] . ", "; | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | $arffString .= $self->countVal . " "; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | ▶ | if (defined $self->class) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | $arffString .= $self->class; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $arffString .= "?" | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | $arffString .= '}'; | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 3 | return($arffString); | |||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 30 | ▶ | sub getSVM { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSVM: called CC=11 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 205 | 30 | my $classes = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 206 | 30 | my $printComments = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 207 | 30 | my $svmString; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | my $i; | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 30 | ▶ | if (((!defined $printComments) || ($printComments == 1)) && (defined $self->comment)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
!defined($printComments) || $printComments == 1 and defined $self->comment
not defined $printComments or $printComments == 1
MC/DC0%0/3
!defined($printComments) || $printComments == 1 and defined $self->comment
not defined $printComments
$printComments == 1
defined $self->comment
Truth table20%1/5
not(A) or B and C
A= not defined $printCommentsB= $printComments == 1C= defined $self->comment
| |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $svmString = $self->comment . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 30 | ▶ | if (defined $self->class) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # warn "====> " . $self->class . ";\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 29 | ▶ | if (scalar(keys %$classes) == 1) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if (exists $classes->{$self->class}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $svmString .= "+1 "; | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $svmString .= "-1 "; | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # warn "==> $classes\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # for my $c (keys(%{$classes})) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # warn "$c : " . $classes->{$c} . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # } | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # warn $self->class . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 29 | ▶ | if (exists $classes->{$self->class}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 29 | $svmString .= $classes->{$self->class} . " "; | |||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | $svmString .= "0 "; | |||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # warn "$svmString\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 30 | ▶ | if (defined $self->qid) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $svmString .= "qid:" . $self->qid . " "; | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 30 | ▶ | for($i=0;$i < $self->countVal;$i++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 1389 | ▶ | if (defined $self->values->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 435 | $svmString .= ($i+1) . ":" . $self->values->[$i] . " "; | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 30 | return($svmString); | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||
| 248 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||
| 250 | Lingua::Ogmios::LearningDataSet::Data - Perl extension for managing the learning data | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | use Lingua::Ogmios::LearningDataSet::Data; | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | my %config = Lingua::Ogmios::LearningDataSet::Data::load_config($rcfile); | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | $yatea = Lingua::Ogmios::LearningDataSet::Data->new($config{"OPTIONS"}, \%config); | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | $yatea->termExtraction($corpus); | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | =head2 function() | ||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||
| 270 | function($rcfile); | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||
| 272 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||
| 275 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | Thierry Hamon <thierry.hamon@limsi.fr> | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||
| 279 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | Copyright (C) 2013 by Thierry Hamon | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | it under the same terms as Perl itself, either Perl version 5.8.6 or, | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||