public function doAction() { $spellCheck = SpellCheckFactory::getInstance(); $spellCheck->setLanguageCode($this->__postInput->lang); //$this->__postInput->sentence = strip_tags( $this->__postInput->sentence ); $specials = array('/\\+/', '/\\*/', '/#/', '/~/', '/@/', '/\\^/'); $replace_specials = array('\\+', '\\*', '\\#', '\\~', '\\@', '\\^'); $sentence = preg_replace($specials, $replace_specials, $this->__postInput->sentence); $this->result['result'] = $spellCheck->getSuggestions($sentence); }
/** * @param array $config * * @return HunspellShell|HunspellSocket */ public static function getInstance($config = array()) { if (self::$_INSTANCE == null) { if (INIT::$SPELL_CHECK_TRANSPORT_TYPE == 'socket') { include_once realpath(dirname(__FILE__) . '/Hunspell/HunspellSocket.php'); self::$_INSTANCE = new HunspellSocket($config); } else { include_once realpath(dirname(__FILE__) . '/Hunspell/HunspellShell.php'); self::$_INSTANCE = new HunspellShell($config); } if (INIT::$SPELL_CHECK_ENABLED) { self::$_INSTANCE->enableSpellCheck(); } } return self::$_INSTANCE; }
public function doAction() { $spellCheck = SpellCheckFactory::getInstance(); $spellCheck->setLanguageCode($this->__postInput->slang); $this->result['error'] = $spellCheck->dictAddWord($this->__postInput->word); }