« blib/lib/Lingua/Ogmios/NLPWrappers/PorterStemmer.pm
↑ Summary
blib/lib/Lingua/Ogmios/NLPWrappers/MarkerDetection.pm »
| 1 | package Lingua::Ogmios::Annotations::SemanticFeatures; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 16 | ▶ | use Lingua::Ogmios::Annotations::Element; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 16 | our @ISA = qw(Lingua::Ogmios::Annotations::Element); | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | # <!-- =================================================== --> | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # <!-- SEMANTIC_FEATURES_LEVEL --> | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # <!-- =================================================== --> | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # <!ELEMENT semantic_features_level | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # (log_id?, comments*, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # semantic_features+) > | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # <!-- semantic_features --> | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # <!ELEMENT semantic_features | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # (id, log_id?, semantic_category, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # refid_semantic_unit) > | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | # <!-- semantic_category --> | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | # <!ELEMENT semantic_category | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # (list_refid_ontology_node)+ > | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # <!-- list_refid_ontology_node --> | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # <!ELEMENT list_refid_ontology_node | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # (refid_ontology_node)+ > | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # <!-- refid_ontology_node --> | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # <!ELEMENT refid_ontology_node | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # (#PCDATA) > | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my ($class, $fields) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | if (!defined $fields->{'id'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $fields->{'id'} = -1; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if ((!defined $fields->{'semantic_category'}) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $fields->{"semantic_category"} or ref($fields->{"semantic_category"} ne "ARRAY") or ref($fields->{"semantic_category"}[0] ne "ARRAY")
not defined $fields->{"semantic_category"} or ref($fields->{"semantic_category"} ne "ARRAY")
MC/DC0%0/3
not defined $fields->{"semantic_category"} or ref($fields->{"semantic_category"} ne "ARRAY") or ref($fields->{"semantic_category"}[0] ne "ARRAY")
not defined $fields->{"semantic_category"}
ref($fields->{"semantic_category"} ne "ARRAY")
ref($fields->{"semantic_category"}[0] ne "ARRAY")
Truth table0%0/4
not(A) or B or C
A= not defined $fields->{"semantic_category"}B= ref($fields->{"semantic_category"} ne "ARRAY")C= ref($fields->{"semantic_category"}[0] ne "ARRAY")
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | (ref($fields->{'semantic_category'} ne "ARRAY")) || | ||||||||||||||||||||||||||||||||||||||||||
| 43 | (ref($fields->{'semantic_category'}->[0] ne "ARRAY"))) { # semantic_category | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | die("semantic_category is not defined"); | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if (!defined $fields->{'refid_semantic_unit'}) { # refid_semantic_unit | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | die("refid_semantic_unit is not defined"); | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | my $semanticfeatures = $class->SUPER::new({ | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | 'id' => $fields->{'id'}, | |||||||||||||||||||||||||||||||||||||||||
| 52 | # 'form' => $fields->{'form'}, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | bless ($semanticfeatures,$class); | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $semanticfeatures->refid_semantic_unit($fields->{'refid_semantic_unit'}); | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $semanticfeatures->semantic_category('list_refid_ontology_node', $fields->{'semantic_category'}); | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (defined $fields->{'log_id'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $semanticfeatures->setLogId($fields->{'log_id'}); | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return($semanticfeatures); | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub semantic_category { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
semantic_category: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $ref; | |||||||||||||||||||||||||||||||||||||||||
| 69 | my $elt; | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $node; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $position; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my $internal_field; | |||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if ((@_) && (scalar @_ == 2)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and scalar @_ == 2
MC/DC0%0/2
@_ and scalar @_ == 2
@_
scalar @_ == 2
Truth table0%0/3
A and B
A= @_B= scalar @_ == 2
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $self->{'semantic_category'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->{'semantic_category'}->{'reference'} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 77 | # warn "reference: " . $self->{'semantic_category'}->{'reference'} . "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}} = []; | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | # $position = index($self->{'semantic_category'}->{'reference'}, "list_"); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | # if ($position == 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # $internal_field = substr($self->{'semantic_category'}->{'reference'}, $position + 5); | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # } else { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | # $internal_field = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | foreach $elt (@$ref) { | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my @tmp; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | foreach $node (@$elt) { | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | push @tmp, $node; | |||||||||||||||||||||||||||||||||||||||||
| 91 | # warn "node: $node (" . join(":", @tmp) . ")\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | push @{$self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}}, \@tmp; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | # foreach $elt (@$ref) { | ||||||||||||||||||||||||||||||||||||||||||
| 96 | # foreach $node (@$elt) { | ||||||||||||||||||||||||||||||||||||||||||
| 97 | # push @{$self->{$self->{'reference'}}}, $node; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | return($self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}); | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub first_node_first_semantic_category { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first_node_first_semantic_category: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return($self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}->[0]->[0]); | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub refid_semantic_unit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refid_semantic_unit: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | # my $old_refid = $self->{'refid_semantic_unit'}; | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->{'refid_semantic_unit'} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 117 | # if (defined $old_refid) { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | return($self->{'refid_semantic_unit'}); | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub reference { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reference: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return($self->refid_semantic_unit); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub XMLout { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
XMLout: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my ($self, $order) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return($self->SUPER::XMLout("semantic_features", $order)); | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub toString { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toString: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $semf; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $semfString = ""; | |||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | # foreach $semf (@{$self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}}) { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | foreach $semf (@{$self->semantic_category}) { | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $semfString .= join('/', @$semf) . ":"; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | chop $semfString; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return($semfString); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub semantic_categorySize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
semantic_categorySize: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return(scalar(@{$self->semantic_category})) | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 16 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | __END__ | ||||||||||||||||||||||||||||||||||||||||||