blib/lib/Lingua/Ogmios/NLPWrappers/YaTeA.pm

filter: Statementstmt 13.5% 70 / 517 Branchbran 1.2% 2 / 162 Conditioncond 0.0% 0 / 72 MC/DCmcdc 0.0% 0 / 36 Subroutinesub 78.9% 15 / 19 Podpod 0.0% 0 / 2 totaltotal 10.7% 87 / 808 CC 120 SCAR 75.7
CC
120
Cov
10%
_outputParsing
3660.0
run
1212.4
_makeCRFINPUT
240.0
CRAP 1937.0
« blib/lib/Lingua/Ogmios/NLPWrappers/TermTagger.pm ↑ Summary blib/lib/Lingua/Ogmios/NLPWrappers/AwkWordSegmentizer.pm »
1 package Lingua::Ogmios::NLPWrappers::YaTeA;
2  
3  
4 2 our $VERSION='0.1';
5  
6 2 ▶use Lingua::Ogmios::NLPWrappers::Wrapper;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Lingua::Ogmios::Annotations::SemanticUnit;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Lingua::Ogmios::Annotations::SemanticFeatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Lingua::Ogmios::Annotations::Phrase;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use Lingua::Ogmios::Annotations::SyntacticRelation;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use UNIVERSAL;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 ▶use Encode qw(:fallbacks);;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶use XML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 # use File::Path 'remove_tree';
23  
24 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 2 our @ISA = qw(Lingua::Ogmios::NLPWrappers::Wrapper);
28  
29 2 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
30 2 my ($class, $config, $tmpfile_prefix, $logfile, $position, $no_standard_output, $out_stream) = @_;
31
32 2 warn "[LOG] Creating a wrapper of the " . $config->comments . "\n";
33
34 2 my $lang;
35 my $lang2;
36 2 my $YaTeA = $class->SUPER::new($config, $tmpfile_prefix, $logfile, $position, $no_standard_output, $out_stream);
37  
38 2 ▶ if (defined $YaTeA->_config->configuration->{'CONFIG'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $YaTeA->_config->configuration->{"CONFIG"}) 2 0 2
39 2 foreach $lang (keys %{$YaTeA->_config->configuration->{'CONFIG'}}) {
40 4 ▶ if ($lang =~ /language=([\w]+)/io) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lang =~ /language=([\w]+)/io) 4 0 4
41 4 $lang2 = $1;
42 # $YaTeA->_setOption($lang2, "ONLY_SYNTACTIC_RELATIONS", "only_synt_rel", 0);
43 4 $YaTeA->_setOption($lang2,"TAGGEDSENTFIELDS", "tagged_sent_fields", "IF:POSTAG:LM:ID:DOCID:SEMTAG");
44 4 $YaTeA->_setOption($lang2,"TAGGEDSENTSEPINFOS", "tagged_sent_sep_infos", "/");
45 4 $YaTeA->_setOption($lang2,"TAGGEDSENTSEPTERMCOMPONENTS", "tagged_sent_sep_term_components", " ");
46 4 $YaTeA->_setOption($lang2,"TAGGEDSENTSEPWORDS", "tagged_sent_sep_words", " ");
47 4 $YaTeA->_setOption($lang2,"TAGGEDSENTSEPSENTENCES", "tagged_sent_sep_sentences", "\n");
48 4 $YaTeA->_setOption($lang2,"TAGGEDSENTSEPSECTIONS", "tagged_sent_sep_sections", "");
49 }
50 4 $YaTeA->_setGeneralOption("PRINTOUTPUTSECTION", "print_output_section", 0);
51 }
52 }
53  
54
55  
56 2 $YaTeA->_input_filename($tmpfile_prefix . ".YaTeA.in");
57 2 $YaTeA->_output_filename(dirname($tmpfile_prefix)); # . ".YaTeA.out");
58 2 $YaTeA->_output_hash({'phrase_set' => undef});
59  
60 2 unlink($YaTeA->_input_filename);
61
62 2 return($YaTeA);
63 }
64  
65 2 ▶sub _inputYaTeA {
Subroutine _inputYaTeA: called CC=1 SCAR=0.4
66 2 my ($self) = @_;
67  
68 2 warn "[LOG] Making input\n";
69  
70 2 $self->getTimer->startsLap("making input");
71
72 2 $self->_printTreeTaggerFormatOutput($self->_input_filename);
73  
74 0 $self->getTimer->_printTimesBySteps;
75 0 warn "[LOG] done\n";
76 }
77  
78 0 ▶sub _processYaTeA {
Subroutine _processYaTeA: not called CC=3 SCAR=24.8
79 0 my ($self, $lang) = @_;
80
81 0 $self->getTimer->startsLap("Term extraction");
82 0 warn "[LOG] " . $self->_config->comments . "\n";
83  
84
85 0 $lang = $self->_documentSet->[0]->getAnnotations->getLanguage;
86  
87 0 my $perlModule = $self->_config->commands($lang)->{PerlModule};
88  
89 0 eval "require $perlModule";
90 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
91 0 warn $@ . "\n";
92 0 die "Problem while loading perlModule $perlModule - Abort\n\n";
93 } else {
94 0 $self->getTimer->lapStartUserTimeBySteps;
95 0 warn "Run term extraction Module $perlModule\n";
96  
97 0 eval "require $perlModule" . "::Corpus";
98 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
99 0 warn $@ . "\n";
100 0 die "Problem while loading perlModule $perlModule - Abort\n\n";
101 }
102 0 my $configFile = $self->_config->configFile($lang)->{"YATEACONF"};
103
104 0 warn "Loading $configFile\n";
105  
106 0 my %config_yatea = Lingua::YaTeA::load_config($configFile);
107 0 my $yatea = Lingua::YaTeA->new($config_yatea{"OPTIONS"}, \%config_yatea);
108  
109 0 $self->_output_hash({'yatea' => $yatea});
110
111  
112 0 $yatea->getOptionSet->addOption("output-path", $self->_output_filename);
113  
114 0 my $corpus_path = $self->_input_filename;
115  
116 0 my $corpus = Lingua::YaTeA::Corpus->new($corpus_path,$yatea->getOptionSet,$yatea->getMessageSet);
117  
118 0 $self->_output_hash()->{'corpus'} = $corpus;
119  
120 0 my $sentence_boundary = $yatea->getOptionSet->getSentenceBoundary;
121 0 my $document_boundary = $yatea->getOptionSet->getDocumentBoundary;
122  
123 0 $yatea->loadTestifiedTerms(\$Lingua::YaTeA::process_counter,$corpus,$sentence_boundary,$document_boundary,$yatea->getOptionSet->MatchTypeValue,$yatea->getMessageSet,$yatea->getOptionSet->getDisplayLanguage);
124  
125 0 print STDERR $Lingua::YaTeA::process_counter++ . ") " . ($yatea->getMessageSet->getMessage('LOAD_CORPUS')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\n";
126  
127 0 $corpus->read($sentence_boundary,$document_boundary,$yatea->getFSSet,$yatea->getTestifiedTermSet,$yatea->getOptionSet->MatchTypeValue,$yatea->getMessageSet,$yatea->getOptionSet->getDisplayLanguage, $yatea->getOptionSet->getLanguage);
128
129 0 my $phrase_set = Lingua::YaTeA::PhraseSet->new;
130  
131 0 $self->_output_hash()->{'phrase_set'} = $phrase_set;
132
133 0 print STDERR $Lingua::YaTeA::process_counter++ . ") " . ($yatea->getMessageSet->getMessage('CHUNKING')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\n";
134  
135 0 $corpus->chunk($phrase_set,$sentence_boundary,$document_boundary,$yatea->getChunkingDataSet,$yatea->getFSSet,$yatea->getTagSet,$yatea->getParsingPatternSet,$yatea->getTestifiedTermSet,$yatea->getOptionSet);
136 0 $phrase_set->printChunkingStatistics($yatea->getMessageSet,$yatea->getOptionSet->getDisplayLanguage);
137  
138 0 $phrase_set->sortUnparsed;
139
140 0 print STDERR $Lingua::YaTeA::process_counter++ . ") " . ($yatea->getMessageSet->getMessage('PARSING')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\n";
141
142 0 $phrase_set->parseProgressively($yatea->getTagSet,$yatea->getOptionSet->getParsingDirection,$yatea->getParsingPatternSet,$yatea->getChunkingDataSet,$corpus->getLexicon,$corpus->getSentenceSet,$yatea->getMessageSet,$yatea->getOptionSet->getDisplayLanguage,\*STDERR);
143
144 0 $phrase_set->addTermCandidates($yatea->getOptionSet);
145 0 $corpus->termWeighting($phrase_set->getTermCandidates,\*STDERR);
146  
147 0 $corpus->termFiltering($phrase_set->getTermCandidates,\*STDERR, $yatea->getOptionSet->getOption("termFiltering")->getValue);
148 0 $corpus->selectOnTermListStyle($phrase_set->getTermCandidates, $yatea->getOptionSet->getTermListStyle,\*STDERR);
149  
150 0 print STDERR $Lingua::YaTeA::process_counter++ . ") " . ($yatea->getMessageSet->getMessage('RESULTS')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\n";
151
152 0 print STDERR "\t-" . ($yatea->getMessageSet->getMessage('DISPLAY_RAW')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\'". $corpus->getOutputFileSet->getFile('debug')->getPath . "'\n";
153 0 $phrase_set->printPhrases(FileHandle->new(">" . $corpus->getOutputFileSet->getFile('debug')->getPath));
154 0 $phrase_set->printUnparsable($corpus->getOutputFileSet->getFile('unparsable'));
155 0 $phrase_set->printUnparsed($corpus->getOutputFileSet->getFile('unparsed'));
156
157 0 print STDERR "\t-" . ($yatea->getMessageSet->getMessage('DISPLAY_TERM_LIST')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\'". $corpus->getOutputFileSet->getFile('termList')->getPath . "'\n";
158 0 $phrase_set->printTermList($corpus->getOutputFileSet->getFile('termList'),$yatea->getOptionSet->getTermListStyle, undef, $yatea->getOptionSet->getOption("sorting_weight")->getValue, $yatea->getOptionSet->getOption("termFiltering")->getValue);
159  
160 0 print STDERR "\t-" . ($yatea->getMessageSet->getMessage('DISPLAY_TC_XML')->getContent($yatea->getOptionSet->getDisplayLanguage)) . "\'". $corpus->getOutputFileSet->getFile('candidates')->getPath . "'\n";
161 # to remove
162 # $phrase_set->printTermCandidatesXML($corpus->getOutputFileSet->getFile("candidates"), $yatea->getTagSet);
163  
164  
165 0 warn "\n";
166 0 $self->getTimer->lapEndUserTimeBySteps;
167 }
168  
169 0 $self->getTimer->_printTimesBySteps;
170 0 warn "[LOG]\n";
171 0 return($perlModule);
172 }
173  
174 0 ▶sub _outputParsing {
Subroutine _outputParsing: not called CC=60 SCAR=82.1
175 0 my ($self) = @_;
176  
177 0 warn "[LOG] . Parsing output Array\n";
178  
179 0 my $phrase_set = $self->_output_hash()->{'phrase_set'};
180  
181 0 my $term_candidate;
182 my $if;
183 0 my $pos;
184 0 my $lf;
185 0 my $term;
186  
187 0 my $oldTermUnitId;
188  
189 0 my $canonical_form;
190 0 my $termUnit;
191 0 my $semanticFeaturesTermUnit;
192  
193 0 my $document;
194  
195 0 my $yatea = $self->_output_hash()->{'yatea'};
196  
197 0 my $tagset = $yatea->getTagSet;
198  
199 0 my %YateaTermOcc2OgmiosSemUnits;
200 my $sem_unit_id;
201  
202 0 my $occurrence;
203  
204 0 my $weight;
205  
206 0 my $sent_id;
207 0 my $term_offset;
208 0 my $doc;
209 0 my $token;
210 0 my $word;
211 0 my $sent_offset = 0;
212 0 my $to;
213 0 my $term_content = "";
214 0 my $term_content2;
215 my $term2;
216 0 my $token_offset;
217 0 my $phrase;
218 0 my $head_occ;
219 0 my $modifier_occ;
220 0 my $syntacticRelation;
221  
222 0 my %compositeWeights = ('idf' => 1,
223 'tf' => 1,
224 'tf-idf' => 1,
225 );
226 0 my @wperdoc;
227 my $eltWperDoc;
228 0 my $docW;
229 0 my $valueW;
230  
231 0 $self->getTimer->startsLap("output Parsing - term recording");
232  
233 # if ($self->{"only_synt_rel"}->{$self->_documentSet->[0]->getAnnotations->getLanguage} == 0) {
234 0 foreach $term_candidate (values(%{$phrase_set->getTermCandidates}))
235 {
236 0 $self->getTimer->startsLapByCategory('YaTeA');
237 0 ($if,$pos,$lf) = $term_candidate->buildLinguisticInfos($tagset);
238 0 $self->getTimer->endsLapByCategory('YaTeA');
239  
240 # warn "==> $if : $pos : $lf\n";
241 # work around for a yatea bug
242 0 $if =~ s/\' /\'/go;
243 0 $if =~ s/ \- /-/go;
244  
245 0 $self->getTimer->startsLapByCategory('XML::Entities');
246 0 $term = XML::Entities::decode('all',$if);
247 0 $self->getTimer->endsLapByCategory('XML::Entities');
248  
249 0 $self->getTimer->startsLapByCategory('processTerm');
250 0 $canonical_form = $lf;
251 0 $canonical_form =~ s/_/ /go;
252 0 $self->getTimer->endsLapByCategory('processTerm');
253  
254 0 $self->getTimer->startsLapByCategory('weights');
255 0 my %weights_gen;
256 0 foreach $weight ($term_candidate->getWeightNames) {
257 0 $weights_gen{$weight} = $term_candidate->getWeight($weight);
258 }
259 0 $weights_gen{'relevance'} = ( 1 * $term_candidate->isTerm);
260 0 $self->getTimer->endsLapByCategory('weights');
261  
262  
263 0 foreach $occurrence (@{$term_candidate->getOccurrences})
264 {
265 0 $sent_id = $occurrence->getSentence->getInDocID;
266 0 $term_offset = $occurrence->getStartChar;
267 0 $document = $self->_documentSet()->[$occurrence->getDocument->getID ];
268 0 $doc = $occurrence->getDocument->getID;
269  
270 0 $self->getTimer->startsLapByCategory('weights');
271 0 my %weights;
272 0 foreach $weight (keys %weights_gen) {
273 # warn "==> $weight\n";
274 0 ▶ if (exists $compositeWeights{lc($weight)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $compositeWeights{lc $weight}) { } 0 0 0
275 0 @wperdoc = split /;/, $weights_gen{$weight};
276 0 foreach $eltWperDoc (@wperdoc) {
277 0 ($docW, $valueW) = split /:/, $eltWperDoc;
278 0 ▶ if ($doc == $docW) {
Branch: 1 branch
BranchTrueFalseTotal
if ($doc == $docW) 0 0 0
279 0 $weights{$weight} = $valueW;
280 }
281 }
282 # $weights{$weight} = $weights_gen{$weight};
283 } else {
284 0 $weights{$weight} = $weights_gen{$weight};
285 }
286 }
287 0 $self->getTimer->endsLapByCategory('weights');
288
289 0 $token = $document->getAnnotations->getSentenceLevel->getElements->[$sent_id - 1]->{'refid_start_token'};
290  
291 0 $sent_offset = 0;
292 # warn "---> $term_offset\n";
293 0 ▶ while ($sent_offset < $term_offset) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sent_offset < $term_offset) 0 0 0
294 # warn "> " . $token->getContent . "\n";
295 0 ▶ if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($document->getAnnotations->getWordLevel->existsElementFromIndex('list_refid_token', $token->getId)) { } 0 0 0
296 0 $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0];
297 0 $sent_offset += length($word->getForm) + 1;
298 0 my @refs = @{$word->getReference};
299 0 $token = $refs[$#refs]->next;
300 # warn $word->getForm . " : $sent_offset\n";
301 } else {
302 0 ▶ if (!($token->isSep)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($token->isSep) 0 0 0
303 0 ▶ if ($token->getContent =~ /[\x{2019}\x{2032}']/go) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->getContent =~ /[\x{2019}\x{2032}']/go) 0 0 0
304 # warn "-------------\n";
305 0 $sent_offset--;
306 }
307 0 $sent_offset += length($token->getContent) + 1;
308 }
309 0 $token = $token->next;
310 }
311 }
312 # warn "out : $sent_offset\n";
313 0 $term_content = "";
314 0 my @TermTokens;
315 0 $to = $token->getFrom + length($term);
316 0 ▶ while ((defined $token->next) && ($token->isSep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $token->next and $token->isSep) 0 0 0
Condition0%0/3
defined $token->next and $token->isSep
!ll&&!rl&&r
000
MC/DC0%0/2
defined $token->next and $token->isSep
defined $token->next $token->isSep
Truth table0%0/3
A and B
A= defined $token->nextB= $token->isSep
ABresult
0X0
100
111
317 0 $token = $token->next;
318 0 $to = $token->getFrom + length($term);
319 }
320 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $token and (lc $term_content2 ne lc $term2 and $token->getTo <= $to) and do { do { $term_content .= $token->getContent; push @TermTokens, $token; $token = $token->next; $term_content2 = $term_content; $term_content2 =~ s/_/ /go; if ($term_content2 =~ s/([ \n\t]+)/ /go) { $to += length $1; } ; if ($term_content2 =~ s/^( +)//go) { $to += length $1; } ; if ($term_content2 =~ s/([ \n\t]+)$//go) { $to += length $1; } ; $term2 = $term; $term2 =~ s/_/ /go } } 0 0 0
Condition0%0/6
defined $token and (lc $term_content2 ne lc $term2 and $token->getTo <= $to)
!ll&&!rl&&r
000
lc $term_content2 ne lc $term2 and $token->getTo <= $to
!ll&&!rl&&r
000
MC/DC0%0/3
defined $token and (lc $term_content2 ne lc $term2 and $token->getTo <= $to)
defined $token lc $term_content2 ne lc $term2 $token->getTo <= $to
Truth table0%0/4
A and B and C
A= defined $tokenB= lc $term_content2 ne lc $term2C= $token->getTo <= $to
ABCresult
0XX0
10X0
1100
1111
321 0 $term_content .= $token->getContent;
322 0 push @TermTokens, $token;
323
324 0 $token = $token->next;
325 0 $term_content2 = $term_content;
326 0 $term_content2 =~ s/_/ /go;
327 0 ▶ if ($term_content2 =~ s/([ \n\t]+)/ /go) { $to += length($1);}
Branch: 1 branch
BranchTrueFalseTotal
if ($term_content2 =~ s/([ \n\t]+)/ /go) 0 0 0
328 0 ▶ if ($term_content2 =~ s/^( +)//go) {$to += length($1);};
Branch: 1 branch
BranchTrueFalseTotal
if ($term_content2 =~ s/^( +)//go) 0 0 0
329 0 ▶ if ($term_content2 =~ s/([ \n\t]+)$//go) {$to += length($1);}
Branch: 1 branch
BranchTrueFalseTotal
if ($term_content2 =~ s/([ \n\t]+)$//go) 0 0 0
330 0 $term2 = $term;
331 0 $term2 =~ s/_/ /go;
332
333 } while((defined $token) && ((lc($term_content2) ne lc($term2)) && ($token->getTo <= $to)));
334  
335  
336 0 $termUnit = $document->getAnnotations->getSemanticUnitLevel->getElementByStartEndTokens($TermTokens[0], $TermTokens[$#TermTokens]);
337  
338 0 $self->getTimer->startsLapByCategory('creation/branching objects');
339 # warn $termUnit->getForm . "(0 OK - $if)\n";
340 0 $semanticFeaturesTermUnit = undef;
341 0 $oldTermUnitId = -1;
342 0 ▶ if (defined $termUnit) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $termUnit) { } 0 0 0
elsif (lc $term_content2 eq lc $term2) { } 0 0 0
343 # warn "=> " . $termUnit->getForm . " already exists\n";
344 0 ▶ if ($termUnit->isNamedEntity) {
Branch: 2 branches
BranchTrueFalseTotal
if ($termUnit->isNamedEntity) { } 0 0 0
elsif ($termUnit->isTerm) { } 0 0 0
345 # Keep it like this for the moment, when have time, convert in Term
346 } elsif ($termUnit->isTerm) {
347 # warn $termUnit->getForm . "(0 OK - $if)\n";
348 0 $oldTermUnitId = $termUnit->getId;
349 # merge weights
350 # %weights
351 # $termUnit->weights
352 ########################################################################
353 0 ▶ if (defined $termUnit->weights) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $termUnit->weights) 0 0 0
354 0 foreach $weight (keys %weights) {
355 # foreach $weight (keys %{$termUnit->weights}) {
356 0 ▶ if (!defined $termUnit->weight($weight)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $termUnit->weight($weight)) 0 0 0
357 0 $termUnit->weight($weight,$weights{$weight});
358 }
359 }
360 # $weights{'relevance'} = $termUnit->weight("relevance");
361 # $termUnit->weights(\%weights);
362 }
363 0 ▶ if ((defined $canonical_form) && (!defined $termUnit->canonical_form)) {$termUnit->canonical_form($canonical_form)};
Branch: 1 branch
BranchTrueFalseTotal
if (defined $canonical_form and not defined $termUnit->canonical_form) 0 0 0
Condition0%0/3
defined $canonical_form and not defined $termUnit->canonical_form
!ll&&!rl&&r
000
MC/DC0%0/2
defined $canonical_form and not defined $termUnit->canonical_form
defined $canonical_form not defined $termUnit->canonical_form
Truth table0%0/3
A and not(B)
A= defined $canonical_formB= not defined $termUnit->canonical_form
ABresult
0X0
100
111
364 }
365 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'documentID'} = $occurrence->getDocument->getID;
366 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'offset_shift'} = $sent_offset;
367 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'sentence'} = $sent_id;
368 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} = $termUnit->reference_name;
369 0 ▶ if ($termUnit->reference_name eq 'list_refid_token') {
Branch: 1 branch
BranchTrueFalseTotal
if ($termUnit->reference_name eq 'list_refid_token') { } 0 0 0
370 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'list_refid_token'} = undef;
371 } else { #if ($termUnit->reference_name eq 'refid_word') {
372 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{$termUnit->reference_name} = $termUnit->reference;
373 }
374 # } elsif ($termUnit->reference_name eq 'refid_phrase'){
375 # $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'refid_phrase'} = $termUnit->reference;
376 # } els
377 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'semunit'} = $sem_unit_id;
378  
379 ########################################################################
380 # warn "term $term already exists $oldTermUnitId\n";
381 # if ($document->getAnnotations->getSemanticFeaturesLevel->existsElementFromIndex("refid_semantic_unit", $termUnit->getId)) {
382 # $semanticFeaturesTermUnit = $document->getAnnotations->getSemanticFeaturesLevel->getElementFromIndex("refid_semantic_unit", $termUnit->getId)->[0];
383 # }
384 } elsif (lc($term_content2) eq lc($term2)) {
385 # TODO recode XML entities before sending to the term tagger
386 ## Word ?
387 # warn "*** New term: $term2\n";
388 0 $token_offset = $TermTokens[0];
389 0 my @TermWords;
390 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $token_offset and !defined($TermTokens[$#TermTokens]->next) || $token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo and do { do { if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token_offset->getId)) { push @TermWords, $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token_offset->getId)->[0]; $token_offset = $TermWords[$#TermWords]->getLastToken; } ; $token_offset = $token_offset->next } } 0 0 0
Condition0%0/6
defined $token_offset and !defined($TermTokens[$#TermTokens]->next) || $token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo
!ll&&!rl&&r
000
not defined $TermTokens[$#TermTokens]->next or $token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $token_offset and !defined($TermTokens[$#TermTokens]->next) || $token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo
defined $token_offset not defined $TermTokens[$#TermTokens]->next $token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo
Truth table0%0/4
A and not(B) or C
A= defined $token_offsetB= not defined $TermTokens[$#TermTokens]->nextC= $token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo
ABCresult
0XX0
1000
11X1
1011
391 0 ▶ if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token_offset->getId)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token_offset->getId)) 0 0 0
392 ## search the last word
393 0 push @TermWords, $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token_offset->getId)->[0];
394 0 $token_offset = $TermWords[$#TermWords]->getLastToken;
395 }
396 0 $token_offset = $token_offset->next;
397 } while((defined $token_offset) && ((!defined $TermTokens[$#TermTokens]->next) || ($token_offset->getTo < $TermTokens[$#TermTokens]->next->getTo)));
398
399  
400 0 ▶ if ((scalar(@TermTokens) == 0) || (scalar(@TermWords) == 0) ||
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @TermTokens == 0 or scalar @TermWords == 0 or defined $TermTokens[$#TermTokens]->next and $TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo) 0 0 0
Condition0%0/9
scalar @TermTokens == 0 or scalar @TermWords == 0 or defined $TermTokens[$#TermTokens]->next and $TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo
l!l&&r!l&&!r
000
scalar @TermTokens == 0 or scalar @TermWords == 0
l!l&&r!l&&!r
000
defined $TermTokens[$#TermTokens]->next and $TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo
!ll&&!rl&&r
000
MC/DC0%0/4
scalar @TermTokens == 0 or scalar @TermWords == 0 or defined $TermTokens[$#TermTokens]->next and $TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo
scalar @TermTokens == 0 scalar @TermWords == 0 defined $TermTokens[$#TermTokens]->next $TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo
Truth table0%0/5
A or B or C and D
A= scalar @TermTokens == 0B= scalar @TermWords == 0C= defined $TermTokens[$#TermTokens]->nextD= $TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo
ABCDresult
1XXX1
01XX1
00111
000X0
00100
401 ((defined $TermTokens[$#TermTokens]->next) && ($TermTokens[$#TermTokens]->getTo != $TermWords[$#TermWords]->getLastToken->getTo))) {
402 0 @TermWords = ();
403 }
404  
405 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'documentID'} = $occurrence->getDocument->getID;
406 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'offset_shift'} = $sent_offset;
407 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'sentence'} = $sent_id;
408  
409 # $self->getTimer->startsLapByCategory('creation/branching objects');
410  
411 0 ▶ if (scalar @TermWords == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @TermWords == 0) 0 0 0
412 # term is a token list
413 # if (!defined $termUnit) {
414 0 $termUnit = Lingua::Ogmios::Annotations::SemanticUnit->newTerm(
415 {'form' => $term_content,
416 'list_refid_token' => \@TermTokens,
417 "weights" => \%weights
418 });
419 # } else {
420 # # warn "term $term already exists. Skip creation\n";
421 # $weights{'relevance'} = $termUnit->weight("relevance");
422 # $termUnit->weights(\%weights);
423 # $semanticFeaturesTermUnit = undef;
424 # }
425 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} = 'list_refid_token';
426 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'list_refid_token'} = undef;
427 }
428 0 ▶ if (scalar @TermWords == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @TermWords == 1) 0 0 0
429 # term is a word
430 # if (defined $termUnit) {
431 # if (!$termUnit->isNamedEntity) {
432 # # warn "term $term already exists. remove previous term and merge related information\n";
433 # # warn "\t" . $termUnit->getId . "\n";
434 # # warn $termUnit->getForm . "(OK)\n";
435 # $weights{'relevance'} = $termUnit->weight("relevance");
436 # if (!defined $semanticFeaturesTermUnit) {
437 # warn "semantic features not found\n";
438 # }
439 # $document->getAnnotations->delSemanticUnit($termUnit);
440 # }
441 # }
442 0 $termUnit = Lingua::Ogmios::Annotations::SemanticUnit->newTerm(
443 {'form' => $term_content,
444 'refid_word' => $TermWords[0],
445 "weights" => \%weights
446 });
447 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} = 'refid_word';
448 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'refid_word'} = $TermWords[0];
449 }
450 0 ▶ if (scalar @TermWords > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @TermWords > 1) 0 0 0
451 # term is a phrase
452 0 $phrase = Lingua::Ogmios::Annotations::Phrase->new(
453 { 'refid_word' => \@TermWords,
454 'form' => $term_content,
455 }
456 );
457 0 $document->getAnnotations->addPhrase($phrase);
458  
459 # if (defined $termUnit) {
460 # # warn "term $term already exists. remove previous term and merge related information\n";
461 # $weights{'relevance'} = $termUnit->weight("relevance");
462 # $document->getAnnotations->delSemanticUnit($termUnit);
463 # }
464  
465 0 $termUnit = Lingua::Ogmios::Annotations::SemanticUnit->newTerm(
466 {'form' => $term_content,
467 'refid_phrase' => $phrase,
468 "weights" => \%weights
469 });
470 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} = 'refid_phrase';
471 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'refid_phrase'} = $phrase;
472 }
473  
474 0 ▶ if ((defined $canonical_form) && (!defined $termUnit->canonical_form)) {$termUnit->canonical_form($canonical_form)};
Branch: 1 branch
BranchTrueFalseTotal
if (defined $canonical_form and not defined $termUnit->canonical_form) 0 0 0
Condition0%0/3
defined $canonical_form and not defined $termUnit->canonical_form
!ll&&!rl&&r
000
MC/DC0%0/2
defined $canonical_form and not defined $termUnit->canonical_form
defined $canonical_form not defined $termUnit->canonical_form
Truth table0%0/3
A and not(B)
A= defined $canonical_formB= not defined $termUnit->canonical_form
ABresult
0X0
100
111
475 0 ▶ if (defined $termUnit) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $termUnit) 0 0 0
476 0 $sem_unit_id = $document->getAnnotations->addSemanticUnit($termUnit);
477 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'semunit'} = $sem_unit_id;
478 }
479 # if (defined $semanticFeaturesTermUnit) {
480 # # warn "reconnect semantic features to the right term $sem_unit_id (old: $oldTermUnitId)\n";
481 # $document->getAnnotations->getSemanticFeaturesLevel->delElementFromIndex($oldTermUnitId, "refid_semantic_unit", $semanticFeaturesTermUnit);
482 # $semanticFeaturesTermUnit->refid_semantic_unit($sem_unit_id);
483 # $document->getAnnotations->getSemanticFeaturesLevel->addElementToIndex($semanticFeaturesTermUnit, "refid_semantic_unit");
484 # $document->getAnnotations->delSemanticUnit($oldTermUnit);
485 # }
486 # }
487 } else {
488 # warn "term content ($term_content) doesn't match with the search term $term (term offset: $term_offset : sent_id: $sent_id : doc: $doc -- " . $document->getId . ")\n";
489 }
490 0 $self->getTimer->endsLapByCategory('creation/branching objects');
491 }
492 }
493 0 $self->getTimer->_printTimeByCategory(0);
494 0 $self->getTimer->_printTimesBySteps;
495 # }
496 0 $self->getTimer->startsLap("output Parsing - syntactic relation recording");
497 0 warn "Add syntactic relations\n";
498 # Second foreach to add syntactic relations
499  
500 0 foreach $term_candidate (values(%{$phrase_set->getTermCandidates}))
501 {
502 0 ($if,$pos,$lf) = $term_candidate->buildLinguisticInfos($tagset);
503  
504 # warn "term: $if\n";
505 0 ▶ if((blessed($term_candidate)) &&($term_candidate->isa('Lingua::YaTeA::MultiWordTermCandidate'))) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($term_candidate) and $term_candidate->isa("Lingua::YaTeA::MultiWordTermCandidate")) 0 0 0
Condition0%0/3
builtin::blessed($term_candidate) and $term_candidate->isa("Lingua::YaTeA::MultiWordTermCandidate")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($term_candidate) and $term_candidate->isa("Lingua::YaTeA::MultiWordTermCandidate")
builtin::blessed($term_candidate) $term_candidate->isa("Lingua::YaTeA::MultiWordTermCandidate")
Truth table0%0/3
A and B
A= builtin::blessed($term_candidate)B= $term_candidate->isa("Lingua::YaTeA::MultiWordTermCandidate")
ABresult
0X0
100
111
506 0 foreach $occurrence (@{$term_candidate->getOccurrences}) {
507 0 ▶ if (exists ($YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}{$occurrence->getID}) 0 0 0
508 0 ▶ if (($head_occ = $self->_getOccFromTermOcc($term_candidate->getRootHead->getKey, $phrase_set, $occurrence->getStartChar, $occurrence->getEndChar, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'sentence'})) == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head_occ = $self->_getOccFromTermOcc($term_candidate->getRootHead->getKey, $phrase_set, $occurrence->getStartChar, $occurrence->getEndChar, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}{$occurrence->getID}{"sentence"})) == -1) 0 0 0
509 0 warn "Occurrence not found (H)\n";
510 }
511 # if ($head_occ != -1) {
512 # warn $head_occ->{"documentID"} . "\n";
513 # warn "head_occ: $head_occ\n";
514 # warn "\t" . $head_occ->{$head_occ->{'type'}}->getId . "\n";
515 # warn "\t" . $head_occ->{$head_occ->{'type'}}->getForm . "\n";
516 # }
517 # $term_refid_head = $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$head_occ}->{'semunit'};
518  
519 0 ▶ if (($modifier_occ = $self->_getOccFromTermOcc($term_candidate->getRootModifier->getKey, $phrase_set, $occurrence->getStartChar, $occurrence->getEndChar, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'sentence'})) == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (($modifier_occ = $self->_getOccFromTermOcc($term_candidate->getRootModifier->getKey, $phrase_set, $occurrence->getStartChar, $occurrence->getEndChar, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}, $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}{$occurrence->getID}{"sentence"})) == -1) 0 0 0
520 0 warn "Occurrence not found (M)\n";
521 }
522 # if ($modifier_occ != -1) {
523 # warn $modifier_occ->{"documentID"} . "\n";
524 # warn "modifier_occ: $modifier_occ\n";
525 # warn "\t" . $modifier_occ->{$modifier_occ->{'type'}}->getId . "\n";
526 # warn "\t" . $modifier_occ->{$modifier_occ->{'type'}}->getForm . "\n";
527 # }
528 # $term_refid_modifier = $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$modifier_occ}->{'semunit'};
529  
530 0 ▶ if (($head_occ == -1) || ($modifier_occ == -1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head_occ == -1 or $modifier_occ == -1) { } 0 0 0
Condition0%0/3
$head_occ == -1 or $modifier_occ == -1
l!l&&r!l&&!r
000
MC/DC0%0/2
$head_occ == -1 or $modifier_occ == -1
$head_occ == -1 $modifier_occ == -1
Truth table0%0/3
A or B
A= $head_occ == -1B= $modifier_occ == -1
ABresult
1X1
011
000
531 0 warn "head and/or Modifier not found\n";
532 0 warn "\t Term " . $term_candidate->buildLinguisticInfos($tagset) . "\n";
533 } else {
534 # warn "head_occ: $head_occ\n";
535 # warn "\t" . $head_occ->{$head_occ->{'type'}}->getId . "\n";
536 # warn "\t" . $head_occ->{$head_occ->{'type'}}->getForm . "\n";
537 # warn "modifier_occ: $modifier_occ\n";
538 # warn "\t" . $modifier_occ->{$modifier_occ->{'type'}}->getId . "\n";
539 # warn "\t" . $modifier_occ->{$modifier_occ->{'type'}}->getForm . "\n";
540  
541 0 $document = $self->_documentSet->[$head_occ->{"documentID"}];
542  
543 # warn $head_occ->{$head_occ->{'type'}} . " == " . $modifier_occ->{$modifier_occ->{'type'}} . "\n";
544 0 ▶ if ((!defined $head_occ->{'type'}) || (!defined $modifier_occ->{'type'}) ||
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $head_occ->{"type"} && defined $modifier_occ->{"type"} && exists $$head_occ{$head_occ->{"type"}} && exists $$modifier_occ{$modifier_occ->{"type"}} or $$head_occ{$head_occ->{"type"}} eq "" or $$modifier_occ{$modifier_occ->{"type"}} eq "" or $$head_occ{$head_occ->{"type"}} == $$modifier_occ{$modifier_occ->{"type"}}) 0 0 0
Condition0%0/18
not defined $head_occ->{"type"} && defined $modifier_occ->{"type"} && exists $$head_occ{$head_occ->{"type"}} && exists $$modifier_occ{$modifier_occ->{"type"}} or $$head_occ{$head_occ->{"type"}} eq "" or $$modifier_occ{$modifier_occ->{"type"}} eq "" or $$head_occ{$head_occ->{"type"}} == $$modifier_occ{$modifier_occ->{"type"}}
l!l&&r!l&&!r
000
not defined $head_occ->{"type"} && defined $modifier_occ->{"type"} && exists $$head_occ{$head_occ->{"type"}} && exists $$modifier_occ{$modifier_occ->{"type"}} or $$head_occ{$head_occ->{"type"}} eq "" or $$modifier_occ{$modifier_occ->{"type"}} eq ""
l!l&&r!l&&!r
000
not defined $head_occ->{"type"} && defined $modifier_occ->{"type"} && exists $$head_occ{$head_occ->{"type"}} && exists $$modifier_occ{$modifier_occ->{"type"}} or $$head_occ{$head_occ->{"type"}} eq ""
l!l&&r!l&&!r
000
defined $head_occ->{'type'} && defined $modifier_occ->{'type'} && exists $$head_occ{$head_occ->{'type'}} && exists $$modifier_occ{$modifier_occ->{'type'}}
!ll&&!rl&&r
000
defined $head_occ->{"type"} and defined $modifier_occ->{"type"} and exists $$head_occ{$head_occ->{"type"}}
!ll&&!rl&&r
000
defined $head_occ->{"type"} and defined $modifier_occ->{"type"}
!ll&&!rl&&r
000
MC/DC0%0/7
not defined $head_occ->{"type"} && defined $modifier_occ->{"type"} && exists $$head_occ{$head_occ->{"type"}} && exists $$modifier_occ{$modifier_occ->{"type"}} or $$head_occ{$head_occ->{"type"}} eq "" or $$modifier_occ{$modifier_occ->{"type"}} eq "" or $$head_occ{$head_occ->{"type"}} == $$modifier_occ{$modifier_occ->{"type"}}
defined $head_occ->{"type"} defined $modifier_occ->{"type"} exists $$head_occ{$head_occ->{"type"}} exists $$modifier_occ{$modifier_occ->{'type'}} $$head_occ{$head_occ->{"type"}} eq "" $$modifier_occ{$modifier_occ->{"type"}} eq "" $$head_occ{$head_occ->{"type"}} == $$modifier_occ{$modifier_occ->{"type"}}
Truth table0%0/8
not(A and B and C && D) or E or F or G
A= defined $head_occ->{"type"}B= defined $modifier_occ->{"type"}C= exists $$head_occ{$head_occ->{"type"}}D= exists $$modifier_occ{$modifier_occ->{'type'}}E= $$head_occ{$head_occ->{"type"}} eq ""F= $$modifier_occ{$modifier_occ->{"type"}} eq ""G= $$head_occ{$head_occ->{"type"}} == $$modifier_occ{$modifier_occ->{"type"}}
ABCDEFGresult
0XXXXXX1
10XXXXX1
110XXXX1
1110XXX1
11111XX1
111101X1
11110011
11110000
545 (!exists $head_occ->{$head_occ->{'type'}}) || (!exists $modifier_occ->{$modifier_occ->{'type'}}) ||
546 ($head_occ->{$head_occ->{'type'}} eq "") || ($modifier_occ->{$modifier_occ->{'type'}} eq "") ||
547 ($head_occ->{$head_occ->{'type'}} == $modifier_occ->{$modifier_occ->{'type'}})
548 ) {
549 0 warn "Something wrong: head and modifier are equals or undefined?\n";
550 0 warn "\t Term " . $term_candidate->buildLinguisticInfos($tagset) . "\n";
551 0 next;
552 }
553  
554  
555 # warn "Add Head_of\n";
556 # warn $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} . "\n";
557 # warn $head_occ->{'type'} . "\n";
558 $syntacticRelation = Lingua::Ogmios::Annotations::SyntacticRelation->new(
559 { 'syntactic_relation_type' => 'Head_of',
560 $head_occ->{'type'} . '_head' => $head_occ->{$head_occ->{'type'}},
561 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} . '_modifier' => $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{$YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'}},
562 }
563 );
564 0 $document->getAnnotations->addSyntacticRelation($syntacticRelation);
565  
566 # warn "Add Modifier_of\n";
567 $syntacticRelation = Lingua::Ogmios::Annotations::SyntacticRelation->new(
568 { 'syntactic_relation_type' => 'Modifier_of',
569 $modifier_occ->{'type'} . '_head' => $modifier_occ->{$modifier_occ->{'type'}},
570 0 $head_occ->{'type'} . '_modifier' => $head_occ->{$head_occ->{'type'}},
571 }
572 );
573 0 $document->getAnnotations->addSyntacticRelation($syntacticRelation);
574  
575 # warn "Add Component_in_modifier_position\n";
576 $syntacticRelation = Lingua::Ogmios::Annotations::SyntacticRelation->new(
577 { 'syntactic_relation_type' => 'Component_in_modifier_position',
578 $modifier_occ->{'type'} . '_head' => $modifier_occ->{$modifier_occ->{'type'}},
579 0 $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'} . '_modifier' => $YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{$YateaTermOcc2OgmiosSemUnits{$occurrence->getDocument->getID}->{$occurrence->getID}->{'type'}},
580 }
581 );
582 0 $document->getAnnotations->addSyntacticRelation($syntacticRelation);
583 # warn "done\n";
584 }
585 }
586 }
587 }
588 }
589 # $document->getAnnotations->getSemanticFeaturesLevel->printIndex("refid_semantic_unit");
590 0 $self->getTimer->_printTimesBySteps;
591  
592 0 warn "[LOG] done\n";
593 }
594  
595 sub _getOccFromTermOcc
596 0 ▶{
Subroutine _getOccFromTermOcc: not called CC=7 SCAR=40.3
597 0 my ($self, $termKey, $phrase_set, $start_char, $end_char, $ref_YateaTermOcc2OgmiosSemUnits, $sent_id) = @_;
598  
599 0 my @occurrences;
600 my $i;
601 0 my $term_candidate = $phrase_set->getTermCandidates->{$termKey};
602  
603 0 @occurrences = @{$term_candidate->getOccurrences};
604  
605 0 $i = 0;
606 0 ▶ while (($i<scalar(@occurrences)) && (($sent_id != $occurrences[$i]->getSentence->getInDocID) || ($start_char > $occurrences[$i]->getStartChar) || ($end_char < $occurrences[$i]->getStartChar))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @occurrences and $sent_id != $occurrences[$i]->getSentence->getInDocID || $start_char > $occurrences[$i]->getStartChar || $end_char < $occurrences[$i]->getStartChar) 0 0 0
Condition0%0/9
$i < scalar @occurrences and $sent_id != $occurrences[$i]->getSentence->getInDocID || $start_char > $occurrences[$i]->getStartChar || $end_char < $occurrences[$i]->getStartChar
!ll&&!rl&&r
000
$sent_id != $occurrences[$i]->getSentence->getInDocID or $start_char > $occurrences[$i]->getStartChar or $end_char < $occurrences[$i]->getStartChar
l!l&&r!l&&!r
000
$sent_id != $occurrences[$i]->getSentence->getInDocID or $start_char > $occurrences[$i]->getStartChar
l!l&&r!l&&!r
000
MC/DC0%0/4
$i < scalar @occurrences and $sent_id != $occurrences[$i]->getSentence->getInDocID || $start_char > $occurrences[$i]->getStartChar || $end_char < $occurrences[$i]->getStartChar
$i < scalar @occurrences $sent_id != $occurrences[$i]->getSentence->getInDocID $start_char > $occurrences[$i]->getStartChar $end_char < $occurrences[$i]->getStartChar
Truth table0%0/5
A and B or C or D
A= $i < scalar @occurrencesB= $sent_id != $occurrences[$i]->getSentence->getInDocIDC= $start_char > $occurrences[$i]->getStartCharD= $end_char < $occurrences[$i]->getStartChar
ABCDresult
0XXX0
10000
11XX1
101X1
10011
607 0 $i++;
608 }
609 # warn "i: $i\n";
610  
611 0 ▶ if ($i < scalar @occurrences) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @occurrences) 0 0 0
612 0 ▶ if (defined $ref_YateaTermOcc2OgmiosSemUnits->{$occurrences[$i]->getID}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $$ref_YateaTermOcc2OgmiosSemUnits{$occurrences[$i]->getID}) { } 0 0 0
613 0 return($ref_YateaTermOcc2OgmiosSemUnits->{$occurrences[$i]->getID});
614 } else {
615 0 return(-1);
616 }
617 }
618 0 return(-1);
619 }
620  
621  
622 2 ▶sub run {
Subroutine run: called CC=36 SCAR=71.0
Pod undocumented
623 2 my ($self, $documentSet) = @_;
624  
625 2 warn "*** TODO: check if the level exists\n";
626 # Set variables according the the configuration
627 2 my $output;
628 my @no_standard_output;
629 2 $self->_documentSet($documentSet);
630  
631 2 warn "[LOG] " . $self->_config->comments . " ... \n";
632  
633 2 $self->_inputYaTeA;
634  
635 0 my $command_line = $self->_processYaTeA;
636  
637 # warn "===> " . $self->_no_standard_output . "\n";
638 # warn "\t" . $self->_position . "\n";
639  
640 0 my $fh = *STDOUT;
641 0 ▶ if (defined($self->_out_stream)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->_out_stream) 0 0 0
642 0 $fh = $self->_out_stream;
643 }
644  
645 0 ▶ if (($self->_position eq "last") && ($self->_no_standard_output)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_position eq 'last' and $self->_no_standard_output) { } 0 0 0
Condition0%0/3
$self->_position eq "last" and $self->_no_standard_output
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_position eq "last" and $self->_no_standard_output
$self->_position eq "last" $self->_no_standard_output
Truth table0%0/3
A and B
A= $self->_position eq "last"B= $self->_no_standard_output
ABresult
0X0
100
111
646 0 ▶ if (ref($self->_no_standard_output) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->_no_standard_output eq 'ARRAY') { } 0 0 0
647 # warn $self->_no_standard_output . "\n";
648 0 @no_standard_output = @{$self->_no_standard_output};
649 } else {
650 0 push @no_standard_output, $self->_no_standard_output;
651 }
652 0 foreach $output (@no_standard_output) {
653 0 warn "print no standard output (" . $output . ")\n";
654 # warn $self->_output_hash()->{'yatea'} . "\n";
655  
656 0 ▶ if ($output eq "XML") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "XML") 0 0 0
657 0 warn "print XML output\n";
658 0 ▶ if ($self->{print_output_section}) {print $fh "==== XML ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
659 0 $self->_output_hash()->{'phrase_set'}->printTermCandidatesXML("stdout",$self->_output_hash()->{'yatea'}->getTagSet,$fh);
660 }
661 0 ▶ if ($output eq "DOT") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "DOT") 0 0 0
662 0 warn "print dot output\n";
663 0 ▶ if ($self->{print_output_section}) {print $fh "==== DOT ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
664 0 $self->_output_hash()->{'phrase_set'}->printListTermCandidatesDot($self->_output_hash()->{'yatea'}->getTagSet,$fh);
665 # $self->_output_hash()->{'phrase_set'}->printTermCandidatesDot2("stdout",$self->_output_hash()->{'yatea'}->getTagSet);
666 }
667 0 ▶ if ($output eq "TOPICDEFINITION") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TOPICDEFINITION") 0 0 0
668 0 ▶ if ($self->{print_output_section}) {print $fh "==== TOPICDEFINITION ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
669 0 warn "print topic definition : (" . scalar(@{$self->_documentSet()}) . ")\n";
670 0 my $line;
671 my @parts;
672 0 my @urls;
673 0 my @ids;
674 0 my $id;
675 0 foreach $line (@{$self->_output_hash()->{'phrase_set'}->getTopicDefinition("all", "autonomy")}) {
676 # warn "$line\n";
677 # $document = $self->_documentSet()->[$occurrence->getDocument->getID ];
678 0 @parts = split /:/, $line; # /
679 0 @ids = split /,/, pop @parts; # /
680 0 @urls = ();
681 0 foreach $id (@ids) {
682 # warn "-> $id\n";
683 # warn $self->getDocId2DocIndex->{$id} . "\n";
684 0 push @urls, @{$self->_documentSet()->[$self->getDocId2DocIndex->{$id}]->getAnnotations->getURLs};
685 }
686 0 print join(":", @parts);
687 0 print "|";
688 0 print join(" ", @urls);
689 0 print "\n";
690 }
691 # print "__END__\n";
692 }
693 0 ▶ if ($output eq "HTML") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "HTML") 0 0 0
694 0 ▶ if ($self->{print_output_section}) {print $fh "==== HTML ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
695 0 $self->_outputParsing;
696 0 $self->HTMLoutput;
697 }
698 0 ▶ if ($output eq "HTML2") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "HTML2") 0 0 0
699 0 ▶ if ($self->{print_output_section}) {print $fh "==== HTML2 ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
700 0 warn "print HTML output\n";
701 $self->_output_hash()->{'corpus'}->printCandidatesAndUnparsedInCorpus(
702 $self->_output_hash()->{'phrase_set'}->getTermCandidates,
703 $self->_output_hash()->{'phrase_set'}->getUnparsable,
704 "stdout",
705 $self->_output_hash()->{'yatea'}->getOptionSet->getSentenceBoundary,
706 $self->_output_hash()->{'yatea'}->getOptionSet->getDocumentBoundary,
707 $self->_output_hash()->{'yatea'}->getOptionSet->getOption('COLOR_BLIND'),
708 $self->_output_hash()->{'yatea'}->getOptionSet->getOption('PARSED_COLOR'),
709 0 $self->_output_hash()->{'yatea'}->getOptionSet->getOption('UNPARSED_COLOR'),
710 );
711  
712 # $self->_output_hash()->{'corpus'}->getOutputFileSet->getFile('candidatesAndUnparsedInCorpus'),
713  
714 }
715 0 ▶ if ($output eq "TXT") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TXT") 0 0 0
716 0 ▶ if ($self->{print_output_section}) {print $fh "==== TXT ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
717 0 warn "==> print Text file in $fh\n";
718 0 $self->_output_hash()->{'phrase_set'}->printTermList('stdout',$self->_output_hash()->{'yatea'}->getOptionSet->getTermListStyle,$fh);
719 }
720 0 ▶ if ($output eq "TERMANDHEAD") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TERMANDHEAD") 0 0 0
721 0 ▶ if ($self->{print_output_section}) {print $fh "==== TERMANDHEAD ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
722 0 warn "print Term->Head output\n";
723 # mininal
724 0 $self->_output_hash()->{'phrase_set'}->printTermAndHeadList('stdout',$self->_output_hash()->{'yatea'}->getOptionSet->getTermListStyle,$fh,undef,undef);
725 }
726 0 ▶ if ($output eq "TERMANDROOTHEAD") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TERMANDROOTHEAD") 0 0 0
727 # global
728 0 ▶ if ($self->{print_output_section}) {print $fh "==== TERMANROOTDHEAD ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
729 0 warn "print Term->RootHead output\n";
730 0 $self->_output_hash()->{'phrase_set'}->printTermAndRootHeadList('stdout',$self->_output_hash()->{'yatea'}->getOptionSet->getTermListStyle,$fh,undef,undef);
731 }
732 0 ▶ if ($output eq "TTG") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TTG") 0 0 0
733 0 ▶ if ($self->{print_output_section}) {print $fh "==== TTG ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
734 0 warn "print TTG output\n";
735 0 $self->_output_hash()->{'phrase_set'}->printTermCandidatesTTG('stdout',$self->_output_hash()->{'yatea'}->getOptionSet->getTTGStyle,$fh);
736 }
737 0 ▶ if ($output eq "FFTTG") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "FFTTG") 0 0 0
738 0 ▶ if ($self->{print_output_section}) {print $fh "==== FFTTG ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
739 0 warn "print FF and TTG output on oneline\n";
740 0 $self->_output_hash()->{'phrase_set'}->printTermCandidatesFFandTTG('stdout',$self->_output_hash()->{'yatea'}->getOptionSet->getTTGStyle,$self->_output_hash()->{'yatea'}->getTagSet,$fh);
741 }
742 0 ▶ if ($output eq "TermAndComp") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TermAndComp") 0 0 0
743 0 ▶ if ($self->{print_output_section}) {print $fh "==== TermAndComp ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
744 0 warn "print Terms and Components on oneline\n";
745 0 $self->_output_hash()->{'phrase_set'}->printTermCandidatesAndComponents('stdout',$self->_output_hash()->{'yatea'}->getOptionSet->getTTGStyle,$fh,$self->_output_hash()->{'yatea'}->getTagSet, undef);
746 }
747 0 ▶ if ($output eq "TAGGEDSENT") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TAGGEDSENT") 0 0 0
748 0 ▶ if ($self->{print_output_section}) {print $fh "==== TAGGEDSENT ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
749 0 warn "print Tagged Sentence output\n";
750 0 $self->_outputParsing;
751 0 my $lang = $self->_documentSet->[0]->getAnnotations->getLanguage;
752 0 my @f = split /:/, $self->{"tagged_sent_fields"}->{$lang};
753 0 my $rank = 1;
754 0 my %fields = map { $_ => $rank++; } @f;
755 0 $self->_makeTaggedSentences({}, $fh, $self->{"tagged_sent_sep_infos"}->{$lang}, $self->{"tagged_sent_sep_words"}->{$lang}, $self->{"tagged_sent_sep_sentences"}->{$lang}, $self->{"tagged_sent_sep_sections"}->{$lang}, $self->{"tagged_sent_sep_term_components"}->{$lang}, \%fields);
756 }
757 0 ▶ if ($output eq "TAGGEDSENTREC") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "TAGGEDSENTREC") 0 0 0
758 0 ▶ if ($self->{print_output_section}) {print $fh "==== TAGGEDSENTREC ====\n";}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"print_output_section"}) 0 0 0
759 0 warn "print Tagged Sentence Recursive output\n";
760 0 $self->_outputParsing;
761 0 my $lang = $self->_documentSet->[0]->getAnnotations->getLanguage;
762 0 my @f = split /:/, $self->{"tagged_sent_fields"}->{$lang};
763 0 my $rank = 1;
764 0 my %fields = map { $_ => $rank++; } @f;
765 0 $self->_makeTaggedSentencesRec({}, $fh, $self->{"tagged_sent_sep_infos"}->{$lang}, $self->{"tagged_sent_sep_words"}->{$lang}, $self->{"tagged_sent_sep_sentences"}->{$lang}, $self->{"tagged_sent_sep_sections"}->{$lang}, $self->{"tagged_sent_sep_term_components"}->{$lang}, \%fields);
766 }
767 0 ▶ if ($output eq "CRFINPUT") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "CRFINPUT") 0 0 0
768 0 warn "print Tagged Sentence output (CRFINPUT)\n";
769 0 $self->_outputParsing;
770 0 $self->_makeTaggedSentences({}, $fh, "\t", "\n");
771 }
772 0 ▶ if ($output eq "QALD") {
Branch: 1 branch
BranchTrueFalseTotal
if ($output eq "QALD") 0 0 0
773 0 warn "print Tagged Sentence output (QALD)\n";
774 0 $self->_outputParsing;
775 0 $self->_QALDoutput(\*STDOUT);
776 }
777 }
778 } else {
779 # $self->_output_hash()->{'phrase_set'}->printTermCandidatesXML("stderr",$self->_output_hash()->{'yatea'}->getTagSet);
780 0 $self->_outputParsing;
781 }
782 # # Put log information
783 0 my $information = { 'software_name' => $self->_config->name,
784 'comments' => $self->_config->comments,
785 'command_line' => $command_line,
786 'list_modified_level' => ['phrase_level', 'semantic_unit_level', 'syntactic_relation_level'],
787 };
788 0 $self->_log($information);
789  
790 0 $self->getTimer->_printTimes;
791 0 $self->getTimer->_printTimesInLine($self->_config->name);
792  
793 0 warn "[LOG] done\n";
794 }
795  
796 0 ▶sub _makeCRFINPUT {
Subroutine _makeCRFINPUT: not called CC=15 SCAR=54.8
797 0 my ($self, $fh) = @_;
798  
799 0 my $phrase_set = $self->_output_hash()->{'phrase_set'};
800  
801 0 my $term_candidate;
802 my $if;
803 0 my $pos;
804 0 my $lf;
805 0 my $term;
806 0 my $occurrence;
807 0 my $sent_id;
808 0 my $term_offset;
809 0 my $doc;
810 0 my $token;
811 0 my $word;
812 0 my $sent_offset = 0;
813 0 my $to;
814 0 my $term_content = "";
815 0 my $term_content2;
816 my $document;
817 0 my $yatea = $self->_output_hash()->{'yatea'};
818 0 my $tagset = $yatea->getTagSet;
819 0 my $term2;
820 my $termUnit;
821  
822 0 foreach $term_candidate (values(%{$phrase_set->getTermCandidates})) {
823 0 ($if,$pos,$lf) = $term_candidate->buildLinguisticInfos($tagset);
824  
825 0 warn "term: $if\n";
826 0 $term = XML::Entities::decode('all',$if);
827 0 warn "term: $if\n";
828 0 foreach $occurrence (@{$term_candidate->getOccurrences}) {
829 0 ▶ if ($occurrence->isMaximal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($occurrence->isMaximal) 0 0 0
830 0 $sent_id = $occurrence->getSentence->getInDocID;
831 0 $term_offset = $occurrence->getStartChar;
832 0 $document = $self->_documentSet()->[$occurrence->getDocument->getID ];
833 0 $doc = $occurrence->getDocument->getID;
834 0 warn $occurrence->getStartChar . "\n";
835 0 warn $occurrence->getEndChar . "\n";
836 }
837 0 $token = $document->getAnnotations->getSentenceLevel->getElements->[$sent_id - 1]->{'refid_start_token'};
838  
839 0 $sent_offset = 0;
840 # warn "---> $term_offset\n";
841 0 ▶ while ($sent_offset < $term_offset) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sent_offset < $term_offset) 0 0 0
842 # warn "> " . $token->getContent . "\n";
843 0 ▶ if ($document->getAnnotations->getWordLevel->existsElementFromIndex("list_refid_token", $token->getId)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($document->getAnnotations->getWordLevel->existsElementFromIndex('list_refid_token', $token->getId)) { } 0 0 0
844 0 $word = $document->getAnnotations->getWordLevel->getElementFromIndex("list_refid_token", $token->getId)->[0];
845 0 $sent_offset += length($word->getForm) + 1;
846 0 my @refs = @{$word->getReference};
847 0 $token = $refs[$#refs]->next;
848 # warn $word->getForm . " : $sent_offset\n";
849 } else {
850 0 ▶ if (!($token->isSep)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($token->isSep) 0 0 0
851 0 ▶ if ($token->getContent =~ /[\x{2019}\x{2032}']/go) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->getContent =~ /[\x{2019}\x{2032}']/go) 0 0 0
852 # warn "-------------\n";
853 0 $sent_offset--;
854 }
855 0 $sent_offset += length($token->getContent) + 1;
856 }
857 0 $token = $token->next;
858 }
859 }
860 # warn "out : $sent_offset\n";
861 0 $term_content = "";
862 0 my @TermTokens;
863 0 $to = $token->getFrom + length($term);
864 0 ▶ while ($token->isSep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->isSep) 0 0 0
865 0 $token = $token->next;
866 0 $to = $token->getFrom + length($term);
867 }
868 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $token and (lc $term_content2 ne lc $term2 and $token->getTo <= $to) and do { do { $term_content .= $token->getContent; push @TermTokens, $token; $token = $token->next; $term_content2 = $term_content; $term_content2 =~ s/_/ /go; if ($term_content2 =~ s/([ \n\t]+)/ /go) { $to += length $1; } ; if ($term_content2 =~ s/^( +)//go) { $to += length $1; } ; if ($term_content2 =~ s/([ \n\t]+)$//go) { $to += length $1; } ; $term2 = $term; $term2 =~ s/_/ /go } } 0 0 0
Condition0%0/6
defined $token and (lc $term_content2 ne lc $term2 and $token->getTo <= $to)
!ll&&!rl&&r
000
lc $term_content2 ne lc $term2 and $token->getTo <= $to
!ll&&!rl&&r
000
MC/DC0%0/3
defined $token and (lc $term_content2 ne lc $term2 and $token->getTo <= $to)
defined $token lc $term_content2 ne lc $term2 $token->getTo <= $to
Truth table0%0/4
A and B and C
A= defined $tokenB= lc $term_content2 ne lc $term2C= $token->getTo <= $to
ABCresult
0XX0
10X0
1100
1111
869 0 $term_content .= $token->getContent;
870 0 push @TermTokens, $token;
871
872 0 $token = $token->next;
873 0 $term_content2 = $term_content;
874 0 $term_content2 =~ s/_/ /go;
875 0 ▶ if ($term_content2 =~ s/([ \n\t]+)/ /go) { $to += length($1);}
Branch: 1 branch
BranchTrueFalseTotal
if ($term_content2 =~ s/([ \n\t]+)/ /go) 0 0 0
876 0 ▶ if ($term_content2 =~ s/^( +)//go) {$to += length($1);};
Branch: 1 branch
BranchTrueFalseTotal
if ($term_content2 =~ s/^( +)//go) 0 0 0
877 0 ▶ if ($term_content2 =~ s/([ \n\t]+)$//go) {$to += length($1);}
Branch: 1 branch
BranchTrueFalseTotal
if ($term_content2 =~ s/([ \n\t]+)$//go) 0 0 0
878 0 $term2 = $term;
879 0 $term2 =~ s/_/ /go;
880
881 } while((defined $token) && ((lc($term_content2) ne lc($term2)) && ($token->getTo <= $to)));
882  
883 0 warn "EVENT=\"" . $term . "\" " . $TermTokens[0]->getFrom . " " . $TermTokens[$#TermTokens]->getTo . "\n";
884 # $termUnit = $document->getAnnotations->getSemanticUnitLevel->getElementByStartEndTokens($TermTokens[0], $TermTokens[$#TermTokens]);
885 }
886 }
887 }
888  
889 2 1;
890  
891  
892 __END__
« blib/lib/Lingua/Ogmios/NLPWrappers/TermTagger.pm ↑ Summary blib/lib/Lingua/Ogmios/NLPWrappers/AwkWordSegmentizer.pm »