« blib/lib/Lingua/Ogmios/NLPWrappers/Wrapper.pm
↑ Summary
blib/lib/Lingua/Ogmios/NLPWrappers/LexicalSyntacticPatterns.pm »
| 1 | package Lingua::Ogmios::NLPWrappers::TreeTagger; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | our $VERSION='0.1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Lingua::Ogmios::NLPWrappers::Wrapper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Lingua::Ogmios::Annotations::MorphosyntacticFeatures; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use Lingua::Ogmios::Annotations::Lemma; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use Encode qw(:fallbacks);; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | our @ISA = qw(Lingua::Ogmios::NLPWrappers::Wrapper); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | my ($class, $config, $tmpfile_prefix, $logfile, $position, $no_standard_output) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 6 | warn "[LOG] Creating a wrapper of the TreeTagger\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | my $TreeTagger = $class->SUPER::new($config, $tmpfile_prefix, $logfile, $position, $no_standard_output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | $TreeTagger->_input_filename($tmpfile_prefix . ".TreeTagger.in"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | $TreeTagger->_output_filename($tmpfile_prefix . ".TreeTagger.out"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 6 | unlink($TreeTagger->_input_filename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | unlink($TreeTagger->_output_filename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | return($TreeTagger); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 6 | ▶ | sub _processTreeTagger { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_processTreeTagger: called CC=1 SCAR=0.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 6 | my ($self, $lang) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 6 | warn "[LOG] POS tagger\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 6 | $lang = $self->_documentSet->[0]->getAnnotations->getLanguage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 6 | return($self->_exec_command($self->_defineCommandLine($self->_config->commands($lang)->{TreeTagger_CMD} . " < " . $self->_input_filename . ">" . $self->_output_filename))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | warn "[LOG]\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | sub _inputTreeTagger { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inputTreeTagger: called CC=11 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 6 | my $token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | my $next_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # my $corpus_in = ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 6 | my $document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 6 | my $doc_idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 6 | my $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 6 | my $docId; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | my @corpus_in_t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 6 | my @elementRef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 6 | my $word; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 6 | warn "[LOG] making Decision TreeTagger input\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # foreach $document (@{$self->_documentSet}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 6 | ▶ | for($docId = 0; $docId < scalar(@{$self->_documentSet});$docId++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 9 | $document = $self->_documentSet->[$docId]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 9 | $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 9 | ▶ | for($doc_idx = 0; $doc_idx < scalar(@{$document->getAnnotations->getTokenLevel->getElements});$doc_idx++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 5151 | $token = $document->getAnnotations->getTokenLevel->getElements->[$doc_idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # warn "$doc_idx: " . $token->getContent . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 5151 | ▶ | if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # WORD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $wordform = $word->getForm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $wordform =~ s/[\t\n]/ /gos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $wordform =~ s/ +/ /gos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | push @corpus_in_t, "$wordform"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | push @elementRef, ["word", $docId, [$word->getId]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $doc_idx += $word->getReferenceSize - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $token = $document->getAnnotations->getTokenLevel->getElements->[$doc_idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # warn "$doc_idx: " . $token->getContent . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 5151 | ▶ | if (!($token->isSep)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 2811 | ▶ | if (($token->getContent =~ /[\x{2019}\x{2032}']/go) && ($previously_end_sentence == 0) && ($#corpus_in_t > -1) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$token->getContent =~ /[\x{2019}\x{2032}']/go and $previously_end_sentence == 0 and $#corpus_in_t > -1
$token->getContent =~ /[\x{2019}\x{2032}']/go and $previously_end_sentence == 0
MC/DC33%1/3
$token->getContent =~ /[\x{2019}\x{2032}']/go and $previously_end_sentence == 0 and $#corpus_in_t > -1
$token->getContent =~ /[\x{2019}\x{2032}']/go
$previously_end_sentence == 0
$#corpus_in_t > -1
Truth table50%2/4
A and B and C
A= $token->getContent =~ /[\x{2019}\x{2032}']/goB= $previously_end_sentence == 0C= $#corpus_in_t > -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # (!$document->getAnnotations->getSentenceLevel->existsElementFromIndex("refid_end_token", $token->previous->getId))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 6 | $corpus_in_t[$#corpus_in_t] .= $token->getContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 6 | push @{$elementRef[$#elementRef]->[2]}, $token->getId; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2805 | push @corpus_in_t, $token->getContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2805 | push @elementRef, ["token", $docId, [$token->getId]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2805 | $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5151 | ▶ | if ($document->getAnnotations->getSentenceLevel->existsElementFromIndex("refid_end_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 123 | ▶ | if ($token->isSymb) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 114 | ▶ | if (!($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 114 | $corpus_in_t[$#corpus_in_t] .= "\tSENT"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | push @corpus_in_t, $token->getContent . "\tSENT"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | push @elementRef, ["token", $docId, [$token->getId]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 9 | push @corpus_in_t, ".\tSENT"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 9 | push @elementRef, ["empty",$docId,[]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 123 | $previously_end_sentence = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 6 | $self->_input_array(\@elementRef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 6 | warn "elementRef: " . scalar(@elementRef) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 6 | warn "corpus_in_t: " . scalar(@corpus_in_t) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 6 | open FILE_IN, ">" . $self->_input_filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # print FILE_IN Encode::encode("iso-8859-1", $corpus_in, Encode::FB_DEFAULT); #$corpus_in; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 6 | map {$_ =~ s/[\x{2019}\x{2032}]/\'/go} @corpus_in_t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 6 | print FILE_IN Encode::encode("iso-8859-1", join("\n",@corpus_in_t), Encode::FB_DEFAULT); #$corpus_in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 6 | print FILE_IN "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 6 | close FILE_IN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 6 | warn "[LOG] done\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 6 | ▶ | sub _outputParsing { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outputParsing: called CC=13 SCAR=40.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 6 | my $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | my @TreeTaggerOutput; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 6 | warn "[LOG] . Parsing " . $self->_output_filename . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 6 | ▶ | open FILE_OUT, $self->_output_filename or warn "Can't open the file " . $self->_output_filename;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # binmode(FILE_OUT, ":utf8"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 6 | ▶ | while($line = <FILE_OUT>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ($line ne "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # $line =~ s/œ/oe/go; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # $line =~ s//oe/go; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my @tmp = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # work around some strange tagging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if (!defined $tmp[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $tmp[1] = "SYM"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if ((!defined $tmp[2]) || ($tmp[2] eq '@card@') || ($tmp[2] eq '@ord@')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $tmp[2] or $tmp[2] eq "\@card\@" or $tmp[2] eq "\@ord\@"
not defined $tmp[2] or $tmp[2] eq "\@card\@"
MC/DC0%0/3
not defined $tmp[2] or $tmp[2] eq "\@card\@" or $tmp[2] eq "\@ord\@"
not defined $tmp[2]
$tmp[2] eq "\@card\@"
$tmp[2] eq "\@ord\@"
Truth table0%0/4
not(A) or B or C
A= not defined $tmp[2]B= $tmp[2] eq "\@card\@"C= $tmp[2] eq "\@ord\@"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $tmp[2] = $tmp[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # warn "$line\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | push @TreeTaggerOutput, \@tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 6 | close FILE_OUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 6 | warn "TT output size: " . scalar(@TreeTaggerOutput) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 6 | my $TreeTaggerOutput_idx = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # my $TreeTaggerInput_idx = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 6 | my $docId; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | my $document; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 6 | my $word; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 6 | my $posInLemma; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 6 | my $posInWord; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 6 | my $substringBefore; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 6 | my $substringAfter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 6 | ▶ | for($TreeTaggerOutput_idx = 0; $TreeTaggerOutput_idx < scalar(@{$self->_input_array}) ; $TreeTaggerOutput_idx++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 2814 | $document = $self->_documentSet->[$self->_input_array->[$TreeTaggerOutput_idx]->[1]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # warn join("\t", @{$TreeTaggerOutput[$TreeTaggerOutput_idx]}) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 2814 | ▶ | if ($self->_input_array->[$TreeTaggerOutput_idx]->[0] eq "word") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # warn "=>word\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $word = $document->getAnnotations->getWordLevel->getElementById($self->_input_array->[$TreeTaggerOutput_idx]->[2]->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Correct POSTag if it's named entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if ($word->isNE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] = "NP"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # warn "Remove _ if it's a complex word i.e. a named entity\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # Remove _ if it's a complex word i.e. a named entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # $posInLemma = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # if ((($posInLemma = index($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], "_"), $posInLemma) != -1) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # ((($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx]->[0], "_", $posInLemma)) == -1) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # ($posInLemma != $posInWord))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # # warn "lemma to correct : " . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[2] . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # $substringBefore = substr($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], 0, $posInLemma); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # $substringAfter = substr($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], $posInLemma + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # # warn "New lemma : $substringBefore $substringAfter ($posInLemma)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # $TreeTaggerOutput[$TreeTaggerOutput_idx]->[2] = "$substringBefore $substringAfter"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # $posInLemma++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # } while (($posInLemma != -1) && ($posInLemma != $posInWord) && ($posInLemma < length($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2]))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # work around some strange tagging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # warn "TreeTaggerOutput_idx: $TreeTaggerOutput_idx\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if (!defined $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | warn "** POSTAG not defined for $TreeTaggerOutput_idx (" . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . ")\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] = "SYM"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ($TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] eq "SENT") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] = "NP"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # warn join("\t", @{$TreeTaggerOutput[$TreeTaggerOutput_idx]}) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $MSFeatures = Lingua::Ogmios::Annotations::MorphosyntacticFeatures->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | {'refid_word' => $word, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 'syntactic_category' => $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $document->getAnnotations->addMorphosyntacticFeatures($MSFeatures); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $Lemma = Lingua::Ogmios::Annotations::Lemma->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | {'refid_word' => $word, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 'canonical_form' => $TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $document->getAnnotations->addLemma($Lemma); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # warn "=>other\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # $TreeTaggerOutput_idx++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # foreach $document (@{$self->_documentSet}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 6 | warn "[LOG] done\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub _outputParsing2 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outputParsing2: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | warn "[LOG] . Parsing " . $self->_output_filename . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->_parseTreeTaggerFormatOutput($self->_output_filename, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | warn "[LOG] done\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | sub _outputParsing1 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outputParsing1: not called CC=30 SCAR=68.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | my @TreeTaggerOutput; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $doc_idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $word_idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my $word; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my $posInWord; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my $posInLemma; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $tmpStr = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my $substringBefore; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | my $substringAfter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | my $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | warn "[LOG] . Parsing " . $self->_output_filename . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | open FILE_OUT, $self->_output_filename or warn "Can't open the file " . $self->_output_filename;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # binmode(FILE_OUT, ":utf8"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | while($line = <FILE_OUT>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ($line ne "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | # $line =~ s/œ/oe/go; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | # $line =~ s//oe/go; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my @tmp = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | # work around some strange tagging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if (!defined $tmp[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $tmp[1] = "SYM"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | if ((!defined $tmp[2]) || ($tmp[2] eq '@card@') || ($tmp[2] eq '@ord@')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $tmp[2] or $tmp[2] eq "\@card\@" or $tmp[2] eq "\@ord\@"
not defined $tmp[2] or $tmp[2] eq "\@card\@"
MC/DC0%0/3
not defined $tmp[2] or $tmp[2] eq "\@card\@" or $tmp[2] eq "\@ord\@"
not defined $tmp[2]
$tmp[2] eq "\@card\@"
$tmp[2] eq "\@ord\@"
Truth table0%0/4
not(A) or B or C
A= not defined $tmp[2]B= $tmp[2] eq "\@card\@"C= $tmp[2] eq "\@ord\@"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $tmp[2] = $tmp[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # warn "$line\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | push @TreeTaggerOutput, \@tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | close FILE_OUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # warn "TT output size: " . scalar(@TreeTaggerOutput) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $TreeTaggerOutput_idx = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | foreach $document (@{$self->_documentSet}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | $tmpStr = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | for($doc_idx = 0; $doc_idx < scalar(@{$document->getAnnotations->getTokenLevel->getElements});$doc_idx++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $token = $document->getAnnotations->getTokenLevel->getElements->[$doc_idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # warn "TOK: " . $token->getContent . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # warn "TreeTaggerOutput_idx: $TreeTaggerOutput_idx\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # warn "WORD: " . $word->getForm . " (" . $word->getId . ") " . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # Correct POSTag if it's named entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if ($word->isNE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] = "NP"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # warn "Remove _ if it's a complex word i.e. a named entity\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # Remove _ if it's a complex word i.e. a named entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $posInLemma = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$posInLemma != -1 and $posInLemma != $posInWord and $posInLemma < length $TreeTaggerOutput[$TreeTaggerOutput_idx][2]
$posInLemma != -1 and $posInLemma != $posInWord
MC/DC0%0/3
$posInLemma != -1 and $posInLemma != $posInWord and $posInLemma < length $TreeTaggerOutput[$TreeTaggerOutput_idx][2]
$posInLemma != -1
$posInLemma != $posInWord
$posInLemma < length $TreeTaggerOutput[$TreeTaggerOutput_idx][2]
Truth table0%0/4
A and B and C
A= $posInLemma != -1B= $posInLemma != $posInWordC= $posInLemma < length $TreeTaggerOutput[$TreeTaggerOutput_idx][2]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | if ((($posInLemma = index($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], "_"), $posInLemma) != -1) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
($posInLemma = index($TreeTaggerOutput[$TreeTaggerOutput_idx][2], "_"), $posInLemma) != -1 and ($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx][0], "_", $posInLemma)) == -1 || $posInLemma != $posInWord
($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx][0], "_", $posInLemma)) == -1 or $posInLemma != $posInWord
MC/DC0%0/3
($posInLemma = index($TreeTaggerOutput[$TreeTaggerOutput_idx][2], "_"), $posInLemma) != -1 and ($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx][0], "_", $posInLemma)) == -1 || $posInLemma != $posInWord
($posInLemma = index($TreeTaggerOutput[$TreeTaggerOutput_idx][2], "_"), $posInLemma) != -1
($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx][0], "_", $posInLemma)) == -1
$posInLemma != $posInWord
Truth table0%0/4
A and B or C
A= ($posInLemma = index($TreeTaggerOutput[$TreeTaggerOutput_idx][2], "_"), $posInLemma) != -1B= ($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx][0], "_", $posInLemma)) == -1C= $posInLemma != $posInWord
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ((($posInWord = index($TreeTaggerOutput[$TreeTaggerOutput_idx]->[0], "_", $posInLemma)) == -1) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | ($posInLemma != $posInWord))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # warn "lemma to correct : " . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[2] . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $substringBefore = substr($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], 0, $posInLemma); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $substringAfter = substr($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], $posInLemma + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # warn "New lemma : $substringBefore $substringAfter ($posInLemma)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[2] = "$substringBefore $substringAfter"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $posInLemma++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } while (($posInLemma != -1) && ($posInLemma != $posInWord) && ($posInLemma < length($TreeTaggerOutput[$TreeTaggerOutput_idx]->[2]))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # work around some strange tagging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # warn "TreeTaggerOutput_idx: $TreeTaggerOutput_idx\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | if (!defined $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | warn "** POSTAG not defined for $TreeTaggerOutput_idx (" . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . ")\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] = "SYM"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] eq "SENT") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1] = "NP"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $MSFeatures = Lingua::Ogmios::Annotations::MorphosyntacticFeatures->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | {'refid_word' => $word, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 'syntactic_category' => $TreeTaggerOutput[$TreeTaggerOutput_idx]->[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $document->getAnnotations->addMorphosyntacticFeatures($MSFeatures); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $Lemma = Lingua::Ogmios::Annotations::Lemma->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | {'refid_word' => $word, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 'canonical_form' => $TreeTaggerOutput[$TreeTaggerOutput_idx]->[2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $document->getAnnotations->addLemma($Lemma); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # warn "===> " . $MSFeatures->syntactic_category . " : " . $Lemma->canonical_form . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | $TreeTaggerOutput_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $doc_idx += $word->getReferenceSize - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $token = $document->getAnnotations->getTokenLevel->getElements->[$doc_idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # warn "here (1)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # if ((!($token->isSep)) && (($token->getContent !~ /[\x{2019}\x{2032}']/go) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # ((defined $token->previous) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # ($document->getAnnotations->getSentenceLevel->existsElementFromIndex("refid_end_token", $token->previous->getId))))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # $TreeTaggerOutput_idx++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if (!($token->isSep)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | if (($token->getContent !~ /[\x{2019}\x{2032}']/go) || (length($TreeTaggerOutput[$TreeTaggerOutput_idx]->[0]) == 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $token->getContent =~ /[\x{2019}\x{2032}']/go or length $TreeTaggerOutput[$TreeTaggerOutput_idx][0] == 1
MC/DC0%0/2
not $token->getContent =~ /[\x{2019}\x{2032}']/go or length $TreeTaggerOutput[$TreeTaggerOutput_idx][0] == 1
not $token->getContent =~ /[\x{2019}\x{2032}']/go
length $TreeTaggerOutput[$TreeTaggerOutput_idx][0] == 1
Truth table0%0/3
not(A) or B
A= not $token->getContent =~ /[\x{2019}\x{2032}']/goB= length $TreeTaggerOutput[$TreeTaggerOutput_idx][0] == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | # warn "here (2) : $previously_end_sentence\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $tmpStr .= $token->getContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # warn $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . " / " . $tmpStr . ";(1)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if (length($TreeTaggerOutput[$TreeTaggerOutput_idx]->[0]) == length($tmpStr)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # warn "=> new treetagger line\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $TreeTaggerOutput_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $tmpStr = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # warn ">> " . $token->previous->getContent . ":: $previously_end_sentence\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # if (($previously_end_sentence) || ((defined $token->previous) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # ($document->getAnnotations->getSentenceLevel->existsElementFromIndex("refid_end_token", $token->previous->getId)))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if ($previously_end_sentence) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # warn ">>>> ===\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $TreeTaggerOutput_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | if ($tmpStr ne "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $tmpStr .= $token->getContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # warn $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . " / " . $tmpStr . ";(2)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | if (length($TreeTaggerOutput[$TreeTaggerOutput_idx]->[0]) == length($tmpStr)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # warn "=> new treetagger line\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $TreeTaggerOutput_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $tmpStr = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # warn $token->getContent . " (" . $token->getId . ") " . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if ($document->getAnnotations->getSentenceLevel->existsElementFromIndex("refid_end_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $previously_end_sentence = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | if ($token->isSymb) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $TreeTaggerOutput_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # warn $token->getContent . " (" . $token->getId . ") " . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . " 0 \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $TreeTaggerOutput_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # warn $token->getContent . "(.) ( 000 ) " . $TreeTaggerOutput[$TreeTaggerOutput_idx]->[0] . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | $previously_end_sentence = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # warn "here (3)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | warn "[LOG] done\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 6 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=22 SCAR=55.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 6 | my ($self, $documentSet) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 6 | my $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # Set variables according the the configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 6 | $self->_documentSet($documentSet); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 6 | ▶ | if ($documentSet->[0]->getAnnotations->existsLemmaLevel) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | warn "lemmas exist in the first document\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | warn " Assuming that no lemma idenfication is required for the current document set\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | # return(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 6 | ▶ | if ($documentSet->[0]->getAnnotations->existsMorphosyntacticFeaturesLevel) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | warn "MorphosyntacticFeaturres exist in the first document\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | warn " Assuming that no Part-of-Speech tagging is required for the current document set\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # return(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 6 | warn "[LOG] POS tagger ... \n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 6 | $self->_inputTreeTagger; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 6 | my $command_line = $self->_processTreeTagger; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 6 | $self->_outputParsing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # Put log information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 6 | my $information = { 'software_name' => 'Decision TreeTagger', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 'comments' => 'POS tagging\n', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 'command_line' => $command_line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 'list_modified_level' => ['morphosyntactic_features_level', 'lemma_level'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 6 | $self->_log($information); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 6 | my $document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 6 | foreach $document (@{$documentSet}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 9 | $document->getAnnotations->addLogProcessing( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | Lingua::Ogmios::Annotations::LogProcessing->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | { 'comments' => 'Found ' . $document->getAnnotations->getLemmaLevel->getSize . ' lemma\n', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 9 | $document->getAnnotations->addLogProcessing( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | Lingua::Ogmios::Annotations::LogProcessing->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | { 'comments' => 'Found ' . $document->getAnnotations->getMorphosyntacticFeaturesLevel->getSize . ' morphosyntactic features\n', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # basic check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 9 | ▶ | if ($document->getAnnotations->getLemmaLevel->getSize != $document->getAnnotations->getWordLevel->getSize) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | warn "Document " . $document->getId . ": there is difference between word and lemma size\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 9 | ▶ | if ($document->getAnnotations->getMorphosyntacticFeaturesLevel->getSize != $document->getAnnotations->getWordLevel->getSize) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | warn "Document " . $document->getId . ": there is difference between word and morphosyntactic feature size\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 6 | ▶ | if (($self->_position eq "last") && ($self->_no_standard_output)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_position eq "last" and $self->_no_standard_output
MC/DC0%0/2
$self->_position eq "last" and $self->_no_standard_output
$self->_position eq "last"
$self->_no_standard_output
Truth table33%1/3
A and B
A= $self->_position eq "last"B= $self->_no_standard_output
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if (($self->_no_standard_output eq "IFPOSLM") || ($self->_no_standard_output == 1) || ($self->_no_standard_output == 2) || ($self->_no_standard_output == 3)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$self->_no_standard_output eq "IFPOSLM" or $self->_no_standard_output == 1 or $self->_no_standard_output == 2 or $self->_no_standard_output == 3
$self->_no_standard_output eq "IFPOSLM" or $self->_no_standard_output == 1 or $self->_no_standard_output == 2
$self->_no_standard_output eq "IFPOSLM" or $self->_no_standard_output == 1
MC/DC0%0/4
$self->_no_standard_output eq "IFPOSLM" or $self->_no_standard_output == 1 or $self->_no_standard_output == 2 or $self->_no_standard_output == 3
$self->_no_standard_output eq "IFPOSLM"
$self->_no_standard_output == 1
$self->_no_standard_output == 2
$self->_no_standard_output == 3
Truth table0%0/5
A or B or C or D
A= $self->_no_standard_output eq "IFPOSLM"B= $self->_no_standard_output == 1C= $self->_no_standard_output == 2D= $self->_no_standard_output == 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $self->_printTreeTaggerFormatOutput('stdout', 'LATIN1',0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | if ($self->_no_standard_output eq "IFPOSLMLINE") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | my $document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | my $word; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my $MS_features; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | my $lemma; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my $sentence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $token_start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | my $token_end; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | my $token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | my @word_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my @MS_features_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | my @lemma_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | foreach $document (@{$documentSet}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | foreach $sentence (@{$document->getAnnotations->getSentenceLevel->getElements}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | @word_set = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | @MS_features_set = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | @lemma_set = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | $token_start = $sentence->refid_start_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | $token = $token_start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $token_end = $sentence->refid_end_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | # do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | # if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | # $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | # $lemma = $document->getAnnotations->getLemmaLevel->getElementFromIndex("refid_word", $word->getId)->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # $MS_features = $document->getAnnotations->getMorphosyntacticFeaturesLevel->getElementFromIndex("refid_word", $word->getId)->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # push @word_set, $word->getForm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # push @MS_features_set, $MS_features->syntactic_category; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # push @lemma_set, $lemma->canonical_form; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # $token = $word->end_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # if (!$token->equals($token_end)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # $token = $token->next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # } while (!$token->equals($token_end)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | $lemma = $document->getAnnotations->getLemmaLevel->getElementFromIndex("refid_word", $word->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $MS_features = $document->getAnnotations->getMorphosyntacticFeaturesLevel->getElementFromIndex("refid_word", $word->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | push @word_set, $word->getForm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | push @MS_features_set, $MS_features->syntactic_category; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | push @lemma_set, $lemma->canonical_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $token = $word->end_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | while (!$token->equals($token_end)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $token = $token->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # warn $token->getContent . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | # warn "add\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $lemma = $document->getAnnotations->getLemmaLevel->getElementFromIndex("refid_word", $word->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $MS_features = $document->getAnnotations->getMorphosyntacticFeaturesLevel->getElementFromIndex("refid_word", $word->getId)->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | push @word_set, $word->getForm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | push @MS_features_set, $MS_features->syntactic_category; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | push @lemma_set, $lemma->canonical_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | $token = $word->end_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | if (!$token->isSep) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | push @word_set, $token->getContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | push @MS_features_set, "SYM"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | push @lemma_set, $token->getContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | print join(" ", @word_set); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | print "\t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | print join(" ", @MS_features_set); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | print "\t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | print join(" ", @lemma_set); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | if ($self->_no_standard_output eq "VOCABULARY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $self->_printVocabulary; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | if ($self->_no_standard_output eq "VOCABULARY_ALL") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | binmode(STDOUT, ":utf8"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | print "#####################\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | print "# FF\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $self->_printVocabulary_FF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | print "#####################\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | print "# LM\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | $self->_printVocabulary_LM; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | print "#####################\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | print "# TAGSET\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $self->_printTagSet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | if ($self->_no_standard_output eq "TAGSET") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $self->_printTagSet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # die "You call the 'rum' method of the wrapper class base\n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # You should define a 'run' method for your wrapper\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 6 | $self->getTimer->_printTimesInLine($self->_config->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 6 | warn "[LOG] done\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||