« blib/lib/Lingua/Ogmios/NLPWrappers/SmileyRecognition.pm
↑ Summary
blib/lib/Lingua/Ogmios/Annotations/Sentence.pm »
| 1 | package Lingua::Ogmios::Annotations::MorphosyntacticFeatures; | ||||||||||||||||||||||||||||
| 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 | # <!-- MORPHOSYNTACTIC FEATURES LEVEL --> | ||||||||||||||||||||||||||||
| 11 | # <!-- =================================================== --> | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # <!ELEMENT morphosyntactic_features_level | ||||||||||||||||||||||||||||
| 14 | # (log_id?, comments*, | ||||||||||||||||||||||||||||
| 15 | # morphosyntactic_features+) > | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | # <!-- morphosyntactic_features --> | ||||||||||||||||||||||||||||
| 18 | # <!ELEMENT morphosyntactic_features | ||||||||||||||||||||||||||||
| 19 | # (id, log_id?, (refid_word | | ||||||||||||||||||||||||||||
| 20 | # refid_phrase), syntactic_category, | ||||||||||||||||||||||||||||
| 21 | # category?, type?, gender?, number?, | ||||||||||||||||||||||||||||
| 22 | # case?, mood_vform?, tense?, | ||||||||||||||||||||||||||||
| 23 | # person?, degree?, possessor?, | ||||||||||||||||||||||||||||
| 24 | # formation?, form?) > | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # <!-- type --> | ||||||||||||||||||||||||||||
| 27 | # <!-- applicable for nouns, verbs, | ||||||||||||||||||||||||||||
| 28 | # adjectives, pronouns, determiners, | ||||||||||||||||||||||||||||
| 29 | # adverbs, adpositions, conjunctions, | ||||||||||||||||||||||||||||
| 30 | # numerals --> | ||||||||||||||||||||||||||||
| 31 | # <!ELEMENT type | ||||||||||||||||||||||||||||
| 32 | # (#PCDATA) > | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # <!-- gender --> | ||||||||||||||||||||||||||||
| 35 | # <!-- applicable for nouns, verbs, | ||||||||||||||||||||||||||||
| 36 | # adjectives, pronouns, determiners, | ||||||||||||||||||||||||||||
| 37 | # numerals --> | ||||||||||||||||||||||||||||
| 38 | # <!ELEMENT gender | ||||||||||||||||||||||||||||
| 39 | # (#PCDATA) > | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # <!-- number --> | ||||||||||||||||||||||||||||
| 42 | # <!-- applicable for nouns, verbs, | ||||||||||||||||||||||||||||
| 43 | # adjectives, pronouns, determiners, | ||||||||||||||||||||||||||||
| 44 | # numerals --> | ||||||||||||||||||||||||||||
| 45 | # <!ELEMENT number | ||||||||||||||||||||||||||||
| 46 | # (#PCDATA) > | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | # <!-- case --> | ||||||||||||||||||||||||||||
| 49 | # <!-- applicable for nouns, adjectives, | ||||||||||||||||||||||||||||
| 50 | # pronouns, determiners, numerals --> | ||||||||||||||||||||||||||||
| 51 | # <!ELEMENT case (#PCDATA) > | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | # <!-- mood_vform --> | ||||||||||||||||||||||||||||
| 54 | # <!-- applicable for verbs --> | ||||||||||||||||||||||||||||
| 55 | # <!ELEMENT mood_vform (#PCDATA) > | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | # <!-- tense --> | ||||||||||||||||||||||||||||
| 58 | # <!-- applicable for verbs --> | ||||||||||||||||||||||||||||
| 59 | # <!ELEMENT tense (#PCDATA) > | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | # <!-- person --> | ||||||||||||||||||||||||||||
| 62 | # <!-- applicable for verbs, pronouns, | ||||||||||||||||||||||||||||
| 63 | # determiners --> | ||||||||||||||||||||||||||||
| 64 | # <!ELEMENT person (#PCDATA) > | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | # <!-- degree --> | ||||||||||||||||||||||||||||
| 67 | # <!-- applicable for adjectives, | ||||||||||||||||||||||||||||
| 68 | # adverbs --> | ||||||||||||||||||||||||||||
| 69 | # <!ELEMENT degree (#PCDATA) > | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | # <!-- possessor --> | ||||||||||||||||||||||||||||
| 72 | # <!-- applicable for pronouns, | ||||||||||||||||||||||||||||
| 73 | # determiners --> | ||||||||||||||||||||||||||||
| 74 | # <!ELEMENT possessor (#PCDATA) > | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | # <!-- formation --> | ||||||||||||||||||||||||||||
| 77 | # <!-- applicable for adpositions --> | ||||||||||||||||||||||||||||
| 78 | # <!ELEMENT formation (#PCDATA) > | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | # <!-- syntactic_category --> | ||||||||||||||||||||||||||||
| 81 | # <!-- POS categories --> | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # <!-- category --> | ||||||||||||||||||||||||||||
| 84 | # <!-- Multext POS categories --> | ||||||||||||||||||||||||||||
| 85 | # <!-- Noun (N), Verb (V), Adjective (A), Pronoun | ||||||||||||||||||||||||||||
| 86 | # (P), Determiner (D), Article (T), Adverb | ||||||||||||||||||||||||||||
| 87 | # (R), Adposition (S) Conjunction (C), | ||||||||||||||||||||||||||||
| 88 | # Numerals (M), Interjection (I), Unique (U) | ||||||||||||||||||||||||||||
| 89 | # Resiual (X), Abbreviation (Y) --> | ||||||||||||||||||||||||||||
| 90 | # <!ELEMENT syntactic_category | ||||||||||||||||||||||||||||
| 91 | # (#PCDATA) > | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | 0 | my ($class, $fields) = @_; | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if (!defined $fields->{'id'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 0 | $fields->{'id'} = -1; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if (!defined $fields->{'syntactic_category'}) { # syntactic_category | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 0 | die("syntactic_category is not defined"); | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | my $morphosyntacticfeatures = $class->SUPER::new({ | ||||||||||||||||||||||||||||
| 105 | 0 | 'id' => $fields->{'id'}, | |||||||||||||||||||||||||||
| 106 | # 'form' => $fields->{'form'}, | ||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||||||||||
| 109 | 0 | bless ($morphosyntacticfeatures, $class); | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | $morphosyntacticfeatures->syntactic_category($fields->{'syntactic_category'}); | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 115 | 0 | my $reference_name; | |||||||||||||||||||||||||||
| 116 | my $ref; | ||||||||||||||||||||||||||||
| 117 | 0 | foreach $ref ('refid_phrase', 'refid_word') { | |||||||||||||||||||||||||||
| 118 | 0 | ▶ | if (defined $fields->{$ref}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | 0 | $reference_name = $ref; | |||||||||||||||||||||||||||
| 120 | 0 | last; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | 0 | $i++; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($i == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | die("reference (list) is not defined"); | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | $morphosyntacticfeatures->reference($reference_name, $fields->{$reference_name}); | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | my $field; | |||||||||||||||||||||||||||
| 131 | 0 | foreach $field ('type', 'gender', 'number', 'case', 'mood_vfrom', 'tense', 'person', 'degree', 'possessor', 'formation') { | |||||||||||||||||||||||||||
| 132 | 0 | ▶ | if (defined $fields->{$field}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 0 | $morphosyntacticfeatures->_setField($fields->{$field}); | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if (defined $fields->{'form'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | 0 | $morphosyntacticfeatures->setForm($fields->{'form'}); | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if (defined $fields->{'log_id'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 0 | $morphosyntacticfeatures->setLogId($fields->{'log_id'}); | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | 0 | return($morphosyntacticfeatures); | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub type { | ||||||||||||||||||||||||||
|
Subroutine
type: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 148 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | ▶ | $self->{'type'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 0 | return($self->{'type'}); | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub category { | ||||||||||||||||||||||||||
|
Subroutine
category: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 155 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $self->{'category'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | return($self->{'category'}); | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub syntactic_category { | ||||||||||||||||||||||||||
|
Subroutine
syntactic_category: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 162 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | $self->{'syntactic_category'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | return($self->{'syntactic_category'}); | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub gender { | ||||||||||||||||||||||||||
|
Subroutine
gender: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 169 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $self->{'gender'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 0 | return($self->{'gender'}); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub number { | ||||||||||||||||||||||||||
|
Subroutine
number: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $self->{'number'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | return($self->{'number'}); | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | sub case { | ||||||||||||||||||||||||||
|
Subroutine
case: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 183 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $self->{'case'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 0 | return($self->{'case'}); | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub mood_vform { | ||||||||||||||||||||||||||
|
Subroutine
mood_vform: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 190 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 0 | ▶ | $self->{'mood_vform'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | return($self->{'mood_vform'}); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub tense { | ||||||||||||||||||||||||||
|
Subroutine
tense: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 197 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $self->{'tense'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | return($self->{'tense'}); | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub person { | ||||||||||||||||||||||||||
|
Subroutine
person: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 204 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | $self->{'person'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 0 | return($self->{'person'}); | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | ▶ | sub degree { | ||||||||||||||||||||||||||
|
Subroutine
degree: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 211 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 0 | ▶ | $self->{'degree'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | return($self->{'degree'}); | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub possessor { | ||||||||||||||||||||||||||
|
Subroutine
possessor: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 218 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $self->{'possessor'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | return($self->{'possessor'}); | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | ▶ | sub formation { | ||||||||||||||||||||||||||
|
Subroutine
formation: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 225 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $self->{'formation'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | return($self->{'formation'}); | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 0 | ▶ | sub reference { | ||||||||||||||||||||||||||
|
Subroutine
reference: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 232 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 233 | 0 | my $ref; | |||||||||||||||||||||||||||
| 234 | my $elt; | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 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
| |||||||||||||||||||||||||||||
| 237 | 0 | $self->{'reference'} = shift; | |||||||||||||||||||||||||||
| 238 | # $self->{$self->{'reference'}} = []; | ||||||||||||||||||||||||||||
| 239 | 0 | $ref = shift; | |||||||||||||||||||||||||||
| 240 | 0 | $self->{$self->{'reference'}} = $ref; | |||||||||||||||||||||||||||
| 241 | # foreach $elt (@$ref) { | ||||||||||||||||||||||||||||
| 242 | # push @{$self->{$self->{'reference'}}}, $elt; | ||||||||||||||||||||||||||||
| 243 | # } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 0 | return($self->{$self->{'reference'}}); | |||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub XMLout { | ||||||||||||||||||||||||||
|
Subroutine
XMLout: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 250 | 0 | my ($self, $order) = @_; | |||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 0 | return($self->SUPER::XMLout("morphosyntactic_features", $order)); | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 16 | 1; | |||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | __END__ | ||||||||||||||||||||||||||||