1Lucy::Search::Span(3) User Contributed Perl DocumentationLucy::Search::Span(3)
2
3
4

NAME

6       Lucy::Search::Span - An offset, a length, and a weight.
7

SYNOPSIS

9           my $combined_length = $upper_span->get_length
10               + ( $upper_span->get_offset - $lower_span->get_offset );
11           my $combined_span = Lucy::Search::Span->new(
12               offset => $lower_span->get_offset,
13               length => $combined_length,
14           );
15           ...
16

DESCRIPTION

18       Span objects store information about a span across an array ofX
19       something. The unit is context-dependent.
20
21       Text is one possibility, in which case offset and length might be
22       measured in Unicode code points.  However, the Span could also refer to
23       a span within an array of tokens, for example X in which case the start
24       and offset might be measured in token positions.
25

CONSTRUCTORS

27   new
28           my $span = Lucy::Search::Span->new(
29               offset => 75,     # required
30               length => 7,      # required
31               weight => 1.0,    # default 0.0
32           );
33
34       Create a new Span.
35
36offset - Integer offset, unit is context-dependent.
37
38length - Integer length, unit is context-dependent.
39
40weight - A floating point weight.
41

METHODS

43   get_offset
44           my $int = $span->get_offset();
45
46       Accessor for "offset" attribute.
47
48   set_offset
49           $span->set_offset($offset);
50
51       Setter for "offset" attribute.
52
53   get_length
54           my $int = $span->get_length();
55
56       Accessor for "length" attribute.
57
58   set_length
59           $span->set_length($length);
60
61       Setter for "length" attribute.
62
63   get_weight
64           my $float = $span->get_weight();
65
66       Accessor for "weight" attribute.
67
68   set_weight
69           $span->set_weight($weight);
70
71       Setter for "weight" attribute.
72
73   compare_to
74           my $int = $span->compare_to($other);
75
76       Indicate whether one object is less than, equal to, or greater than
77       another.
78
79other - Another Obj.
80
81       Returns: 0 if the objects are equal, a negative number if "self" is
82       less than "other", and a positive number if "self" is greater than
83       "other".
84

INHERITANCE

86       Lucy::Search::Span isa Clownfish::Obj.
87
88
89
90perl v5.32.1                      2021-01-27             Lucy::Search::Span(3)
Impressum