++ed by:
CKRAS

1 PAUSE user

Andrew Nelson
and 1 contributors

NAME

Data::SearchEngine::Results::Spellcheck - spellcheck role for Spellchecking

VERSION

version 0.33

SYNOPSIS

    package Data::SeachEngine::Foo;
    use Moose;

    with 'Data::SearchEngine::Results::Spellcheck';
    
    sub search {
        # do stuff
        my $results = Data::SearchEngine::Results->new;
        
        $results->set_spell_suggestion('popuar', 
            Data::SearchEngine::Results::Spellcheck::Suggestion->new(
                word => 'popular',  # the suggested replacement
                frequency => 12     # optional, how often it occurs in the index
            )
        );
    }

DESCRIPTION

Provides storage and methods for retrieving spellcheck information.

ATTRIBUTES

spell_collation

Intended to hold the 'suggested' spelling result from spellchecking. A search for "basebll bat" would likely have a collation of "baseball bat". It is so named as it contains a collation of the best results for the various tokens.

spell_frequencies

Hash containing the original token in as the key and the frequency it occurs in the index as the value. This may not be used by all backends.

spell_sugguestions

HashRef of spellcheck suggestions for this query. The HashRef is keyed by the word for which spellcheck suggestions are being provided and the values are the suggestions.

spelled_correctly

Boolean value to signal to the front end if the query was spelled correctly.

METHODS

get_spell_frequency ($word)

Gets the frequency for the specified word.

set_spell_frequency ($word, $frequency)

Sets the frequency for the provided word.

get_spell_suggestion ($word)

Gets the suggestion with the specified name. Returns undef if one does not exist.

set_spell_suggestion

Sets the suggestion with the specified name.

spell_suggestion_words

Returns an array of all the keys of suggestions.

AUTHOR

Cory G Watson <gphat@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Cold Hard Code, LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.