Plucene/Analysis/StopFilter.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 4 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 CC 4 SCAR 10.0
CC
4
Cov
100%
next
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Plucene/Index/FieldInfos.pm ↑ Summary Plucene/Index/Term.pm »
1 package Plucene::Analysis::StopFilter;
2  
3 =head1 NAME
4  
5 Plucene::Analysis::StopFilter - the stop filter
6  
7 =head1 SYNOPSIS
8  
9 # isa Plucene::Analysis::TokenFilter
10  
11 my $next = $stop_filter->next;
12  
13 =head1 DESCRIPTION
14  
15 This removes stop words from a token stream.
16  
17 Instances of the StopFilter class are tokens filters that removes from the
18 indexed text words of your choice. Typically this is used to filter out common
19 words ('the', 'a' 'if' etc) that increase the overhead but add no value during
20 searches.
21  
22 =head1 METHODS
23  
24 =cut
25  
26 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 1 ▶use base 'Plucene::Analysis::TokenFilter';
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 =head2 next
32  
33 my $next = $stop_filter->next;
34  
35 This returns the next input token whose term is not a stop word.
36  
37 =cut
38  
39 10 ▶sub next {
Subroutine next: called CC=4 SCAR=13.9
Pod documented
40 10 my $self = shift;
41 10 ▶ $self->{stophash} ||= { map { $_ => 1 } @{ $self->{stoplist} } };
Condition100%2/2
$self->{"stophash"} ||= {map({$_, 1;} @{$$self{"stoplist"};})}
l!l
82
MC/DC100%1/1
$self->{"stophash"} ||= {map({$_, 1;} @{$$self{"stoplist"};})}
$self->{"stophash"}
Truth table100%2/2
A
A= $self->{"stophash"}
Aresult
11
00
42 10 ▶ while (my $t = $self->input->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $t = $self->input->next) 11 2 13
43 11 ▶ next if exists $self->{stophash}->{ $t->text() };
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"stophash"}{$t->text} 3 8 11
44 8 return $t;
45 }
46 2 return;
47 }
48  
49 1 1;
« Plucene/Index/FieldInfos.pm ↑ Summary Plucene/Index/Term.pm »