Closed (fixed)
Project:
Spell Check
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Aug 2009 at 21:08 UTC
Updated:
24 Jul 2013 at 09:00 UTC
A spell check using GNU Aspell is on its way. Here's some code to make it work with Pspell too. It is still untested, because I haven't yet got Pspell running.
/**
* Execute the spell check using PHP's Pspell extension.
*/
function atraspell_review_pspell($profile, $strings) {
$sug_modes = array(
'fast' => PSPELL_FAST,
'normal' => PSPELL_NORMAL,
'bad-spellers' => PSPELL_BAD_SPELLERS,
);
$sug_mode = $sug_modes[variable_get('atraspell_profile_' . $profile->pid . '_sug_mode', 'normal')];
$dictionary = pspell_new($profile->language, '', '', '', $sug_mode);
$suggestions = array();
foreach ($strings as $string) {
$words = preg_split('#\s#', $string);
foreach ($words as $word) {
if($word_suggestions = pspell_suggest($word)) {
$suggestions[$sid][$word] = $word_suggestions;
}
}
}
return $suggestions;
}
Comments
Comment #1
xanoComment #2
xanoFixed and committed.
Comment #4
xano