Plucene::Plugin::Analyzer::SnowballFilter - Snowball stemming on the token stream


Plucene-Plugin-Analyzer-SnowballAnalyzer documentation Contained in the Plucene-Plugin-Analyzer-SnowballAnalyzer distribution.

Index


Code Index:

NAME

Top

Plucene::Plugin::Analyzer::SnowballFilter - Snowball stemming on the token stream

SYNOPSIS

Top

	# isa Plucene::Analysis:::TokenFilter

	my $token = $porter_stem_filter->next;

DESCRIPTION

Top

This class transforms the token stream as per the Snowball stemming algorithm.

You can find more information on the Snowball algorithm at http://snwoball.tartarus.org/.

METHODS

Top

next

	my $token = $porter_stem_filter->next;

Returns the next input token, after being stemmed.


Plucene-Plugin-Analyzer-SnowballAnalyzer documentation Contained in the Plucene-Plugin-Analyzer-SnowballAnalyzer distribution.
package Plucene::Plugin::Analyzer::SnowballFilter;

use strict;
use warnings;

use Lingua::Stem::Snowball;

use base 'Plucene::Analysis::TokenFilter';

sub next {
	my $self = shift;
	my $t = $self->input->next or return;
	my @r;
	push @r, Lingua::Stem::Snowball::stem($Plucene::Plugin::Analyzer::SnowballAnalyzer::LANG, $t->text);
	$t->text(@r);
	return $t;
}

1;