Lucy::...::Span(3pm)

πŸ“¦
version 0.6.2 Β· 2 versions
, in fedora 43

πŸ’– 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 to 0.0 if 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