Plucene/Analysis/Token.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 90.9% 20 / 22 CC 2 SCAR 3.5
CC
2
Cov
94%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Plucene/Search/TopDocs.pm ↑ Summary Plucene/Index/FieldsWriter.pm »
1 package Plucene::Analysis::Token;
2  
3 =head1 NAME
4  
5 Plucene::Analysis::Token - A term in a field
6  
7 =head1 SYNOPSIS
8  
9 =head1 DESCRIPTION
10  
11 A Token is an occurence of a term from the text of a field. It consists of
12 a term's text, the start and end offset of the term in the text of the field,
13 and a type string.
14  
15 The start and end offsets permit applications to re-associate a token with
16 its source text, e.g., to display highlighted query terms in a document
17 browser, or to show matching text fragments in a KWIC (KeyWord In Context)
18 display, etc.
19  
20 The type is an interned string, assigned by a lexical analyzer
21 (a.k.a. tokenizer), naming the lexical or syntactic class that the token
22 belongs to. For example an end of sentence marker token might be implemented
23 with type "eos". The default token type is "word".
24  
25 =head1 METHODS
26  
27 =cut
28  
29 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 19 ▶use base 'Class::Accessor::Fast';
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 19 __PACKAGE__->mk_accessors(qw[type text start end]);
35  
36 =head2 new
37  
38 my $token = Plucene::Analysis::Token->new({
39 type => $type,
40 text => $text,
41 start => $start,
42 end => $end });
43  
44 This will create a new Plucene::Analysis::Token object.
45
46 =cut
47  
48 144010 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod documented
49 144010 my ($class, %args) = @_;
50 144010 ▶ $args{type} ||= "word";
Condition50%1/2
$args{"type"} ||= "word"
l!l
0144010
MC/DC0%0/1
$args{"type"} ||= "word"
$args{"type"}
Truth table50%1/2
A
A= $args{"type"}
Aresult
11
00
51 144010 $class->SUPER::new({%args});
52 }
53  
54 19 1;
« Plucene/Search/TopDocs.pm ↑ Summary Plucene/Index/FieldsWriter.pm »