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

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