VuFind API Documentation

SpellingProcessor
in package

Solr spelling processor.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Page

Table of Contents

$expand  : bool
Offer expansions on terms as well as basic replacements?
$normalizer  : callable
Callback for normalizing text.
$phrase  : bool
Show the full modified search phrase on screen rather then just the suggested word?
$spellingLimit  : int
Spelling limit
$spellSkipNumeric  : bool
Spell check words with numbers in them?
__construct()  : mixed
Constructor
getSpellingLimit()  : int
Get the spelling limit.
getSuggestions()  : array<string|int, mixed>
Get raw spelling suggestions for a query.
processSuggestions()  : array<string|int, mixed>
Process spelling suggestions.
shouldSkipNumericSpelling()  : bool
Are we skipping numeric words?
tokenize()  : array<string|int, mixed>
Input Tokenizer - Specifically for spelling purposes
doSingleReplace()  : array<string|int, mixed>
Process one instance of a spelling replacement and modify the return data structure with the details of what was done.
formatAndFilterSuggestions()  : array<string|int, mixed>
Support method for getSuggestions()
shouldSkipTerm()  : bool
Should we skip the specified term?

Properties

$expand

Offer expansions on terms as well as basic replacements?

protected bool $expand

$phrase

Show the full modified search phrase on screen rather then just the suggested word?

protected bool $phrase

$spellSkipNumeric

Spell check words with numbers in them?

protected bool $spellSkipNumeric

Methods

__construct()

Constructor

public __construct([Config $config = null ][, callable $normalizer = null ]) : mixed
Parameters
$config : Config = null

Spelling configuration (optional)

$normalizer : callable = null

Callback for normalization of text (optional).

Return values
mixed

getSpellingLimit()

Get the spelling limit.

public getSpellingLimit() : int
Return values
int

getSuggestions()

Get raw spelling suggestions for a query.

public getSuggestions(Spellcheck $spellcheck, AbstractQuery $query) : array<string|int, mixed>
Parameters
$spellcheck : Spellcheck

Complete spellcheck information

$query : AbstractQuery

Query for which info should be retrieved

Tags
throws
Exception
Return values
array<string|int, mixed>

processSuggestions()

Process spelling suggestions.

public processSuggestions(array<string|int, mixed> $suggestions, string $query, Params $params) : array<string|int, mixed>
Parameters
$suggestions : array<string|int, mixed>

Raw suggestions from getSuggestions()

$query : string

Spelling query

$params : Params

Params helper object

Return values
array<string|int, mixed>

shouldSkipNumericSpelling()

Are we skipping numeric words?

public shouldSkipNumericSpelling() : bool
Return values
bool

tokenize()

Input Tokenizer - Specifically for spelling purposes

public tokenize(string $input) : array<string|int, mixed>

Because of its focus on spelling, these tokens are unsuitable for actual searching. They are stripping important search data such as joins and groups, simply because they don't need to be spellchecked.

Parameters
$input : string

Query to tokenize

Return values
array<string|int, mixed>

Tokenized array

doSingleReplace()

Process one instance of a spelling replacement and modify the return data structure with the details of what was done.

protected doSingleReplace(string $term, string $targetTerm, bool $inToken, array<string|int, mixed> $details, array<string|int, mixed> $returnArray, Params $params) : array<string|int, mixed>
Parameters
$term : string

The actually term we're replacing

$targetTerm : string

The term above, or the token it is inside

$inToken : bool

Flag for whether the token or term is used

$details : array<string|int, mixed>

The spelling suggestions

$returnArray : array<string|int, mixed>

Return data structure so far

$params : Params

Params helper object

Return values
array<string|int, mixed>

$returnArray modified

formatAndFilterSuggestions()

Support method for getSuggestions()

protected formatAndFilterSuggestions(AbstractQuery $query, array<string|int, mixed> $info) : array<string|int, mixed>
Parameters
$query : AbstractQuery

Query for which info should be retrieved

$info : array<string|int, mixed>

Spelling suggestion information

Tags
throws
Exception
Return values
array<string|int, mixed>

shouldSkipTerm()

Should we skip the specified term?

protected shouldSkipTerm(AbstractQuery $query, string $term, bool $queryContains) : bool
Parameters
$query : AbstractQuery

Query for which info should be retrieved

$term : string

Term to check

$queryContains : bool

Should we skip the term if it is found in the query (true), or should we skip the term if it is NOT found in the query (false)?

Return values
bool

Search results