Lucy::...alyzer(3pm)

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

πŸ’– Lucy::Analysis::Analyzer β€” the tea β˜•

okay so bestie, welcome to Lucy::Analysis::Analyzer(3pm) β€” the manual page you're reading right now, and honestly? it's giving foundations. this is the abstract base class that handles Tokenize/modify/filter text. that's the whole NAME vibe. πŸ’…


✨ SYNOPSIS ✨

# Abstract base class.

that's it. that's the synopsis. she's abstract, she's mysterious, she doesn't do the work herself, she makes you do it. main character energy honestly. πŸ‘‘


🌸 DESCRIPTION 🌸

so like, an Analyzer is a filter that processes text β€” transforming it from one form into another. periodt. ✨

for instance? an analyzer might break up a long text into smaller pieces (that's RegexTokenizer, hiii), or it might perform case folding to facilitate case-insensitive search (that's Normalizer, mwah πŸ’‹).

it's giving "text goes in, different text comes out." iykyk.


πŸŽ€ CONSTRUCTORS πŸŽ€

new

package MyAnalyzer;
use base qw( Lucy::Analysis::Analyzer );
our %foo;
sub new {
    my $self = shift->SUPER::new;
    my %args = @_;
    $foo{$$self} = $args{foo};
    return $self;
}

Abstract constructor, bestie. it takes no arguments. that's it. that's the whole thing. don't come for her asking for args, she has none. 🫢


πŸ¦‹ ABSTRACT METHODS πŸ¦‹

transform

my $inversion = $analyzer->transform($inversion);

okay so this one's the big one β€” take a single Inversion as input, and return an Inversion. could be the same one (presumably transformed in some way πŸ‘€), or a brand new one. either way, slay.

  • inversion β€” An inversion. yes that's the whole description. she's concise. πŸ’…

⭐ METHODS ⭐

transform_text

my $inversion = $analyzer->transform_text($text);

this one kicks off an analysis chain, creating an Inversion from string input. the default implementation simply creates an initial Inversion with a single Token, then calls transform(). but occasionally subclasses will provide an optimized implementation which minimizes string copies β€” overachievers, we love them, no cap. πŸ”₯

  • text β€” A string. 🌈

split

my $arrayref = $analyzer->split($text);

Analyze text and return an array of token texts. literally that simple, we stan a straightforward method. ✨

  • text β€” A string. πŸ“

dump

my $obj = $analyzer->dump();

Dump the analyzer as hash. πŸ’€ (not that kind of dump bestie, this is the serialization kind.)

Subclasses should call dump() on the superclass. The returned object is a hash which should be populated with parameters of the analyzer.

Returns: A hash containing a description of the analyzer. cute, right?

load

my $obj = $analyzer->load($dump);

Reconstruct an analyzer from a dump. the glow-up in reverse, we love to see it πŸ¦‹

Subclasses should first call load() on the superclass. The returned object is an analyzer which should be reconstructed by setting the dumped parameters from the hash contained in "dump".

⚠️ note that the invocant analyzer is unused. she's just there for moral support. πŸ’–
  • dump β€” A hash.

Returns: An analyzer. iconic.


πŸ‘‘ INHERITANCE πŸ‘‘

Lucy::Analysis::Analyzer isa Clownfish::Obj.

that's the family tree, bestie. she comes from good stock. 🌸


and that's the whole page fr fr πŸ’œ β€” this was Lucy::...alyzer(3pm) from the perl v5.42.0 release, dated 2025-07-25, brought to you by User Contributed Perl Documentation. go forth and analyze your text, you absolute icon πŸŽ€βœ¨

πŸ“¦ where this page comes from