Lucy::...::Span(3pm)
π NAME π
Lucy::Search::Span β an offset, a length, and a weight. That's it. That's the whole girl. β¨
πΈ SYNOPSIS πΈ
my $combined_length = $upper_span->get_length
+ ( $upper_span->get_offset - $lower_span->get_offset );
my $combined_span = Lucy::Search::Span->new(
offset => $lower_span->get_offset,
length => $combined_length,
);
...
okay bestie look at that. two spans walk in, one span walks out, and its length is lowkey just some math. slay.
π¦ DESCRIPTION π¦
So a Span object is literally just a lil container that stores info about a span across an array ofβ¦ something. and the unit?? context-dependent. yes gorl it's giving mysterious. it doesn't know what it's measuring either, that's on you to decide. π
Text is one possibility β in which case offset and length might be measured in Unicode code points. cute! but the Span could also refer to a span within an array of tokens, for example β in which case the start and offset might be measured in token positions. see?? it's flexible like that. main character energy fr fr. π
π CONSTRUCTORS π
new
my $span = Lucy::Search::Span->new(
offset => 75, # required
length => 7, # required
weight => 1.0, # default 0.0
);
Create a new Span. new span, new me, periodt. β¨
offsetβ integer offset, and the unit is context-dependent (required, no skipsies).lengthβ integer length, also context-dependent in unit (also required, do not forget her π).weightβ a floating point weight. defaults to0.0if you don't pass one, which is fine, she's chill.
π METHODS π
get_offset
my $int = $span->get_offset();
Accessor for the "offset" attribute. gets the offset. iconic behaviour honestly.
set_offset
$span->set_offset($offset);
Setter for the "offset" attribute. now you're the one in charge bestie.
get_length
my $int = $span->get_length();
Accessor for the "length" attribute. how long is it?? find out.
set_length
$span->set_length($length);
Setter for the "length" attribute. change it. it's your world. π«Ά
get_weight
my $float = $span->get_weight();
Accessor for the "weight" attribute. a float, as promised.
set_weight
$span->set_weight($weight);
Setter for the "weight" attribute. weigh her however you want π
compare_to
my $int = $span->compare_to($other);
Indicate whether one object is less than, equal to, or greater than another. it's the classic "who's bigger" but make it objects. π
otherβ another Obj.
Returns: 0 if the objects are equal, a negative number if "self" is less than "other", and a positive number if "self" is greater than "other". that's the whole vibe check right there β negative, zero, positive, no cap. π
π INHERITANCE π
Lucy::Search::Span isa Clownfish::Obj. family tree confirmed, she comes from good stock. π§
okay and one last thing bestie β this whole page is from perl v5.42.0, dated 2025-07-25, part of the User Contributed Perl Documentation, filed under Lucy::...::Span(3pm). read it, love it, go measure some spans. bye babes! ππβ¨
π¦ where this page comes from
- fedora 43: perl-Lucy 0.6.2-26.fc43 Β· Apache-2.0 AND MIT AND Unicode-DFS-2015
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms