loaded = false; } function load() { $str = @fread( @fopen($this->filename, 'r') , @filesize($this->filename) ); $str = explode("\n", $str); foreach ($str as $r) { $t = explode("\t\t",$r); if (isset($t[1])) { $this->bwords[] = trim($t[0]); $this->cwords[] = trim($t[1]); } } $str = @fread( @fopen($this->dwfname, 'r') , @filesize($this->dwfname) ); $str = explode("\n", $str); foreach ($str as $r) { $t = explode("\t\t",$r); if (isset($t[1])) { $this->bBldW[] = trim($t[0]); $this->cBldW[] = trim($t[1]); } } $this->specdlmtrs = array(',','.',';',':','?','!'); $this->dontsplit = array( 'http', 'ftp' ); $this->chars = preg_split('//', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZéáűőúöüóíÉÁŰŐÚÖÜÓÍ', -1, PREG_SPLIT_NO_EMPTY); $this->loaded = true; } function splitbyindex( $str, $begin, $chunk ) { return array( 0 => substr( $str, 0, $begin ), 1 => substr( $str, $begin, $chunk ), 2 => substr( $str, $begin+$chunk, strlen($str) - $begin+$chunk ) ); } function check($s) { if (!$this->loaded) $this->load(); $wd = ''; $ds = false; $type = -1; $this->ar = array( -1 => array( N_FALSE, false )); $this->idx = -1; // Tokenizálás - első fázis - felbontás for ($i=0;$iidx++; $this->ar[$this->idx] = array( N_WHITE, $c ); $ds = false; } else { $this->ar[$this->idx][1] .= $c; } } else { if (in_array($c, $this->chars)) { $type = N_WORD; } elseif (in_array($c, $this->specdlmtrs)) { $type = N_DELIMITER; } elseif (trim($c) == '') { $type = N_WHITE; } else { $type = N_OTHER; } if ($this->ar[$this->idx][0] == $type) { $this->ar[$this->idx][1] .= $c; } else { if (($type != N_WORD) && ($type != N_WHITE) && ($this->ar[$this->idx][0] == N_WORD) && (in_array(strtolower($this->ar[$this->idx][1]), $this->dontsplit)) ) { $ds = true; $this->ar[$this->idx][0] = N_URL; $this->ar[$this->idx][1] .= $c; } else { $this->idx++; $this->ar[$this->idx] = array( $type, $c ); } } } } // Többszavas eredmények szűrése $count = count($this->ar)-1; $c_dbl = count($this->bBldW); $this->ar[] = array( N_FALSE, false ); $this->ar[] = array( N_FALSE, false ); $res = ''; // Végeredmény előállítása for ($i = 0; $i<$count; $i++) { $r = $this->ar[$i]; if ($r[0] == N_WORD) { $w = &$r[1]; if (strlen($w) > 1) { $id = array_search(strtolower($w),$this->bwords); if ($id !== false) { $type = ($w[0] == strtoupper($w[0])) ? (($w[1] == strtoupper($w[1])) ? 2 : 1) : 0; if ($type == 2) { $r[1] = strtoupper($this->cwords[$id]); } elseif ($type == 1) { $r[1] = ucfirst($this->cwords[$id]); } else { $r[1] = $this->cwords[$id]; } } } } // --------------------------------------------------------- // if (($r[0] == N_WHITE) && ($this->ar[$i-1][0] == N_WORD) && ($this->ar[$i+1][0] == N_DELIMITER) && (($this->ar[$i+2][0] == N_WORD)) ) { $res .= $this->ar[$i+1][1].$r[1]; $i++; // --------------------------------------------------------- // } elseif (($r[0] == N_WHITE) && ($this->ar[$i-1][0] == N_WORD) && ($this->ar[$i+1][0] == N_DELIMITER) && (($this->ar[$i+2][0] == N_WHITE)) ) { $res .= $this->ar[$i+1][1].$r[1]; $i=$i+2;; // --------------------------------------------------------- // } elseif (($r[0] == N_WHITE) && ($this->ar[$i-1][0] == N_WORD) && (strtolower($this->ar[$i-1][1]) != 'hogy') && ($this->ar[$i+1][0] == N_WORD) && (strtolower($this->ar[$i+1][1]) == 'hogy') ) { $res .= ','.$r[1]; // --------------------------------------------------------- // } elseif (($r[0] == N_DELIMITER) && ($this->ar[$i-1][0] == N_WORD) && ($this->ar[$i+1][0] == N_WORD) ) { $res .= $r[1].' '; // --------------------------------------------------------- // } else { $res .= $r[1]; } echo $i.' : '; switch ($r[0]) { case N_WORD : { echo 'N_WORD '; break; } case N_URL : { echo 'N_URL '; break; } case N_WHITE : { echo 'N_WHITE '; break; } case N_DELIMITER : { echo 'N_DELIMITER '; break; } case N_OTHER : { echo 'N_OTHER '; break; } case N_FALSE : { echo 'N_FALSE '; break; } } echo ' "'.$r[1].'"
'; } unset($this->ar); // PHP4 kompatibilitas, stripos hiánya $tr = strtolower($res); foreach ($this->bBldW as $k => $v) { do { $pos = strpos($tr, ' '.$v.' '); if ($pos !== false) { $tmp = $this->splitbyindex( $res, $pos, strlen(' '.$v.' ') ); $type = ($tmp[1][0] == strtoupper($tmp[1][0])) ? (($tmp[1][1] == strtoupper($tmp[1][1])) ? 2 : 1) : 0; if ($type == 2) { $tmp[1] = strtoupper($this->cBldW[$k]); } elseif ($type == 1) { $tmp[1] = ucfirst($this->cBldW[$k]); } else { $tmp[1] = $this->cBldW[$k]; } $tmp[1] = ' '.$tmp[1].' '; $res = implode('', $tmp); $tr = strtolower($res); unset($tmp); } } while ($pos !== false); } return $res; //return implode('', $this->ar); } } ob_start();echo '
';

$helyes = new helyes();

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	
	$txt = $_POST['txt'];
	
	$txt2 = $helyes->check($txt);
	
} else {
	$txt = 'A legjóbb server keresö.ASEnál sokkal jóbb.Több servert látt.Minden héten köb. fríssül.Ingyenes,több funkicos ,sokk extra.pl. 1 extra: Van 1 friendlist ahol a felvet ismeröseid vanak,megtod nézni hogy melyik serveren és mivel játszanak.Akkár szolhatsz is nekik a nevükre kattintva és nekik a játékba a képernyö jobb alsó sarkába megjelenik 1 kis ablak a leírásal,és csak 1 scroll+x et kell nyomniuk és már elö jöt a beszélgetö ablak ahol válaszolhat és csak 1 ESCet kell nyomni és be is zárul és lehet tovább játszani.+ extra az XFire profilod elmenti 1oldalra mivel menyit játszotál.pl. igy :
http://www.xfire.com/profile/phyisikus
:D


szó , szó,
 egyebet nem mondhatok...


test
Test
TEST
';
	$txt2 = '';
}

echo '
'; $dmp = ob_get_contents(); ob_end_clean(); ?> Bajod van?
Hibás szöveg:

Korrigált szöveg:

Tokenizált szöveg:

Jelenleg tudja:

Szeretném, ha még tudná: