예제 #1
0
	public function __construct($params)
	{
		$this->lang = (isset($params["lang"]) && $params["lang"] != '') ? $params["lang"] : 'en';
		$this->skip_len = $params["skip_length"];

		$this->pspell = (function_exists('pspell_config_create') && ($params["use_pspell"] == "Y"));
		//$this->custom_spell = $params["use_custom_spell"] == "Y";
		$this->custom_spell = false;
		$this->pspell_mode = $params["mode"];

		$this->dics_path = $this->checkDicPath();
		$this->user_dics_path = $this->dics_path."/custom.pws";
		$this->custom_dics_path = $this->dics_path.'/custom_dics/'.$this->lang.'_';

		if($this->custom_spell)
		{
			$this->dic = array();
		}

		if ($this->pspell)
		{
			$pspell_config = pspell_config_create ($this->lang, null, null, 'utf-8');
			pspell_config_ignore($pspell_config, $this->skip_len);
			pspell_config_mode($pspell_config, $params["mode"]);
			pspell_config_personal($pspell_config, $this->user_dics_path);
			$this->pspell_link = pspell_new_config($pspell_config);
		}
	}
 function pspellConfig()
 {
     $pspell_config = pspell_config_create($this->lang);
     pspell_config_ignore($pspell_config, $this->skip_len);
     pspell_config_mode($pspell_config, $this->mode);
     pspell_config_personal($pspell_config, $this->personal_path);
     $this->pspell_link = pspell_new_config($pspell_config);
 }
 function init()
 {
     $link = pspell_config_create($this->langcode);
     pspell_config_ignore($link, $this->ignore);
     if ($this->modus == 0) {
         pspell_config_mode($link, PSPELL_FAST);
     } elseif ($this->modus == 2) {
         pspell_config_mode($link, PSPELL_BAD_SPELLERS);
     } else {
         pspell_config_mode($link, PSPELL_NORMAL);
     }
     $this->resid = @pspell_new_config($link);
     if (!$this->resid) {
         $this->errormsg = 'Could not open dictionary "' . $this->langcode . '"';
     }
 }
예제 #4
0
function init_spell($type, $dict)
{
    $pspell_config = pspell_config_create($dict);
    pspell_config_mode($pspell_config, $type);
    pspell_config_personal($pspell_config, $GLOBALS['FORUM_SETTINGS_PATH'] . "forum.pws");
    pspell_config_ignore($pspell_config, 2);
    define('__FUD_PSPELL_LINK__', pspell_new_config($pspell_config));
    return true;
}
예제 #5
0
$cfg_serv = 'localhost';
$cfg_user = '******';
$cfg_pass = '';
$cfg_db = 'swk';
$cfg_tab = '3';
//////////////////
// po³±cz z baz± danych
$db = DBHelper::connect($cfg_serv, $cfg_user, $cfg_pass, $cfg_db);
// zainicjalizuj pozosta³e klasy
$validation = new Validation('../dict/vulgarism.txt');
$tokenizer = new Tokenizer('../dict/stoplist.txt');
$fsaa = new Fsaa('../dict/lort_acc_full.fsa');
$fsas = new Fsas('../dict/lort_acc_full.fsa');
$fsal = new Fsal('../dict/llems_full.fsa');
$pspell_config = pspell_config_create("pl");
pspell_config_ignore($pspell_config, 4);
pspell_config_mode($pspell_config, PSPELL_FAST);
pspell_config_runtogether($pspell_config, false);
$pspell_link = pspell_new_config($pspell_config);
// uruchomienie stopera, rozpoczêcie zbierania danych czasowych
$stoper = new Timer();
// pobierz zbiór wyników
$res = $db->query("SELECT * FROM comment_{$cfg_tab} WHERE type = 'OK' ORDER BY id");
while ($row = $res->fetch_row()) {
    list($id, $comment, $type) = $row;
    //echo $comment;
    $stoper->set('query');
    // sprawdzenie email i WWW
    if (Validation::findEmail($comment) || Validation::findWWW($comment)) {
        echo 'E' . $id . '--' . $comment . '===' . implode(', ', $tok_comment) . "\n";
        $stoper->set('email');
예제 #6
0
 /**
  * Konstrukor zapewniaj±cy ogóln± inicjalizacjê systemu przygotowywania danych:
  * tokenizer, korekta ortograficzna, uzupe³nianie polskich znaków, wulgaryzmy.
  *
  * @param mysqli $dbconn Obiekt po³±czenia z baz± danych u¿ywany w podklasach.
  * @param string $dictdir Folder ze s³ownikami, stoplistami itp.
  * @param int $idc Identyfikator wykorzystywanego zestawu komentarzy.
  * @param bool $copy_unknown Czy pozostawiaæ nierozpoznane wyrazy?
  * @param array $options Parametry konkretnego klasyfikatora jako tab. asocjacyjna.
  */
 function __construct($dbconn, $dictdir, $idc, $copy_unknown, $options = null)
 {
     $this->idc = $idc;
     $this->copy_unknown = $copy_unknown;
     $this->dbconn = $dbconn;
     if (is_null(self::$validation)) {
         self::$validation = new Validation($dictdir . '/vulgarism.txt');
     }
     if (is_null(self::$tokenizer)) {
         self::$tokenizer = new Tokenizer($dictdir . '/stoplist.txt');
     }
     if (is_null(self::$fsaa)) {
         self::$fsaa = new Fsaa($dictdir . '/lort_acc_full.fsa');
     }
     if (is_null(self::$fsal)) {
         self::$fsal = new Fsal($dictdir . '/llems_full.fsa');
     }
     if (is_null(self::$pspell)) {
         $pspell_config = pspell_config_create("pl");
         // opcje zapewniaj±ce wiêksz± szybko¶æ dzia³ania aspell
         pspell_config_ignore($pspell_config, 4);
         pspell_config_mode($pspell_config, PSPELL_FAST);
         pspell_config_runtogether($pspell_config, false);
         self::$pspell = pspell_new_config($pspell_config);
     }
 }