File Coverage

blib/lib/Plucene/Analysis/StopAnalyzer.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Plucene::Analysis::StopAnalyzer;
2              
3             =head1 NAME
4              
5             Plucene::Analysis::StopAnalyzer - the stop-word analyzer
6              
7             =head1 SYNOPSIS
8              
9             my Plucene::Analysis::StopFilter $sf
10             = Plucene::Analysis::StopAnalyzer->new(@args);
11              
12             =head1 DESCRIPTION
13              
14             Filters LetterTokenizer with LowerCaseFilter and StopFilter.
15              
16             =head1 METHODS
17              
18             =cut
19              
20 1     1   1518 use strict;
  1         3  
  1         40  
21 1     1   7 use warnings;
  1         2  
  1         33  
22              
23 1     1   6 use Plucene::Analysis::LowerCaseTokenizer;
  1         2  
  1         9  
24 1     1   28 use Plucene::Analysis::StopFilter;
  1         2  
  1         14  
25 1     1   43 use base 'Plucene::Analysis::Analyzer';
  1         2  
  1         244  
26              
27             my @stopwords = (
28             "a", "and", "are", "as", "at", "be", "but", "by",
29             "for", "if", "in", "into", "is", "it", "no", "not",
30             "of", "on", "or", "s", "such", "t", "that", "the",
31             "their", "then", "there", "these", "they", "this", "to", "was",
32             "will", "with"
33             );
34              
35             =head2 tokenstream
36              
37             my Plucene::Analysis::StopFilter $sf
38             = Plucene::Analysis::StopAnalyzer->new(@args);
39              
40             Filters LowerCaseTokenizer with StopFilter.
41              
42             =cut
43              
44             sub tokenstream {
45 2     2 1 909 my $self = shift;
46 2         18 return Plucene::Analysis::StopFilter->new({
47             input => Plucene::Analysis::LowerCaseTokenizer->new(@_),
48             stoplist => \@stopwords
49             });
50             }
51              
52             1;