Revision history for GmBowenSpellchecker


Revision [23055]

Last edited on 2016-05-20 07:38:45 by GmBowen [Replaces old-style internal links with new pipe-split links.]
Additions:
This is code derived from a class released at [[http://www.phpclasses.org/browse/package/1992.html | Php Classes]] as a generic PHP Spell Checker and is released under GPL for non-commercial uses. ''(Version 1.1 with improved punctuation & wikicode removal)''
The "dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.10.204/wiki/spellchecker/dictionary.txt | here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.
Deletions:
This is code derived from a class released at [[http://www.phpclasses.org/browse/package/1992.html Php Classes]] as a generic PHP Spell Checker and is released under GPL for non-commercial uses. ''(Version 1.1 with improved punctuation & wikicode removal)''
The "dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.10.204/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.


Revision [18659]

Edited on 2008-01-28 00:12:18 by GmBowen [Modified links pointing to docs server]

No Differences

Revision [11674]

Edited on 2005-11-06 16:02:44 by GmBowen [update link]
Additions:
====Wikka Spellchecker====
This is code derived from a class released at [[http://www.phpclasses.org/browse/package/1992.html Php Classes]] as a generic PHP Spell Checker and is released under GPL for non-commercial uses. ''(Version 1.1 with improved punctuation & wikicode removal)''

I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words can be added or other dictionaries used instead.

If anyone wants to improve this spellchecker, I think it needs a "regular expression" thing (or something) added somewhere that....
- removes anything ""{{""//in//""}}"" these brackets
- removes wiki pagenames
Other slight oddities also crop up (like two words being run together despite the space between them).

I modified the ##handlers/page/edit.php## file by adding this code close to the bottom of the file...
%%(php)
print($output);
// Spellcheck added by GMB
if ($_POST["submit"] == "Spellcheck")
{
include("spellchecker/dictionary_class.php"); // this is the main class and must be included to the main body.
$dr=new dataReader(); // creating a new instance of the class dataReader.
// this class gets the input text and uses the class LookupTable to find misspelt words.
$wrd="";
$j=0;
$i=0;


// instantiate new instance (from jsearchstring from phpclasses.org) to remove punctuation & wikiwords
$jSS=new jSearchString();

//output formatted string
$str = $jSS->parseString($body);

$str= strtolower($str);

$dr->reader($str);
}
// end of Spellcheck code}
else
{
%%

The ##handlers/page/edit.php## file was further altered by adding code for a "Spellcheck" button.....
%%(php)
//finish
// ORIGINAL LINE "<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
// Line below this has added spellcheck button (GMB)
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input name=\"submit\" type=\"submit\" value=\"Spellcheck\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose();
%%

The ##dictionary_class.php## file (provided at phpclasses) was modified to the following (and placed in the directory "spellchecker" in the wiki root).
%%(php)
<?php
//////////////////////////////// Dictionary class originally written by Reza Salehi. ////////////////////////////////////////////
//////////////////////////////// General Public License. ////////////////////////////////////////////
//////////////////////////////// zaalion@yahoo.com, http://zaalion.com ////////////////////////////////////////////
//////////////////////////////// tel : +98 912 2345463 ////////////////////////////////////////////
//////////////////////////////// Dec. 2004. ////////////////////////////////////////////
//////////////////////////////// JSearchString by Johan De Klerk from PHPCLASSES.org ////////////////////////////////////////////
//////////////////////////////// Modified by GMBowen for Wikka Wiki Dec. 2004 under GPL ////////////////////////////////////////////

class hashing
{
function hashFunction($str, $len)
{
$hash=0;
$l = strlen($str);

//step 1
for($i=0; $i<$l; $i++)
$hash+=ord($str[$i])*($i+1)*($i+1);

$hash*=ord($str[0]);
//step 2
$hash%=$len;

return($hash);
}
};

class lookupTable
{
var $MAX=6967;//6967
var $MaxWordLength=45;
var $dictionaryFile="spellchecker/dictionary.txt";
var $lookupTable;
var $MAXLen=16;

function initializeArray()
{
for($i=0; $i<$this->MAX; $i++)
for($j=0; $j<$this->MAXLen; $j++)
$this->lookupTable[$i][$j]=NULL;
}

function readToTable()
{
$this->initializeArray();

$buffer=""; $n=0;
$hash=new hashing();
$index=0;
$buffer="";
$count=0; $i=0;

$fp = fopen ("spellchecker/dictionary.txt", "r");
do
{
$buffer=fgets($fp, $this->MaxWordLength);
$buffer=trim($buffer);

$index=$hash->hashFunction($buffer, $this->MAX);
//---->read process
while($this->lookupTable[$index][$i]!=NULL)
$i++;
$this->lookupTable[$index][$i]=$buffer;
$i=0;
//<--- read process
}
while($buffer);

fclose($fp);
}

function isIn($str)
{
$h=new hashing();
$i=0;
$str=trim($str);
$temp="";

$index=$h->hashFunction($str, $this->MAX);
do
{
$temp=$this->lookupTable[$index][$i++];
if($temp==$str)
return(true);
}
while($temp!=NULL);

return(false);
}

function suggestion($str)
{
$count=0;
$index=-1;
$current=97;
$strC=$str;

for($i=0; $i<strlen($strC); $i++)
{
for($j=0; $j<26; $j++)
{
$strC[$i]= chr($current++);
if($this->isIn($strC))
{
if($count>0) print(" , ");
print($strC);
$count++;
}
}

$strC=$str;
$current=97;
}
return($count);
}
} ;

// modified by GMB from JsearchString
// obtained from phpclasses.org, written by Johan De Klerk released as "Freely Distributable"

class jSearchString {

// other words can be added to this string...probably all actions would be a good idea, and maybe code to list all wikipagenames?

var $wikiwords = array("{{google}}", "{{chat}}", "{{showcode}}", "{{hiddenpages}}", "CategoryWiki");

var $symbols = array('/','\\','\'','"',',','.','<','>','?',';',':','[',']','{','}','|','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');

function parseString($string) {
$string = ' '.$string.' ';
$string = $this->removeWikiwords($string);
$string = $this->removeSymbols($string);
return $string;
}

function removeWikiwords($string) {
for ($i = 0; $i < sizeof($this->wikiwords); $i++) {
$string = str_replace($this->wikiwords[$i],' ',$string);
}

//$string = str_replace(' ',' ',$string);
return trim($string);
}

function removeSymbols($string) {
for ($i = 0; $i < sizeof($this->symbols); $i++) {
$string = str_replace($this->symbols[$i],'',$string);
}

return trim($string);
}
};

class dataReader
{
function reader($strToCheck)
{
$lt=new lookupTable();
print("</p>Spellcheck....");
$lt->readToTable();
print("Completed!<br><br>");

$buffer="";
$words=explode(' ', $strToCheck);
$h=new hashing();
print("<b>These words are mis-spelled, suggestions for correct spellings are provided :<br></b>");
for($i=0; $i<count($words); $i++)
{
$buffer=$words[$i];

if(!($lt->isIn($buffer)))
{

print("<b>   ".$buffer." : </b>");
$sug=1; //added by GMB
if($sug)
$lt->suggestion($buffer);
print("<br>");
}
}
}
};
?>%%

The "dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.10.204/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.

""<a href="http://freelogs.com/stats/g/gmbowen/" target="_top"><img border="0" alt="Free Web Counter" src="http://xyz.freelogs.com/counter/index.php?u=gmbowen&s=a" ALIGN="middle" HSPACE="4" VSPACE="2"></a><script src=http://xyz.freelogs.com/counter/script.php?u=gmbowen></script>
<br><a style="font-size:12" href="http://free-web-directory.com/a/chadwicks/" target="_top"><font style="font-size:12" color="#666666">Chadwicks of Boston</font></a>""


----
Deletions:
====Wikka Spellchecker====
This is code derived from a class released at [[http://www.phpclasses.org/browse/package/1992.html Php Classes]] as a generic PHP Spell Checker and is released under GPL for non-commercial uses. ''(Version 1.1 with improved punctuation & wikicode removal)''

I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words can be added or other dictionaries used instead.

If anyone wants to improve this spellchecker, I think it needs a "regular expression" thing (or something) added somewhere that....
- removes anything ""{{""//in//""}}"" these brackets
- removes wiki pagenames
Other slight oddities also crop up (like two words being run together despite the space between them).

I modified the ##handlers/page/edit.php## file by adding this code close to the bottom of the file...
%%(php)
print($output);
// Spellcheck added by GMB
if ($_POST["submit"] == "Spellcheck")
{
include("spellchecker/dictionary_class.php"); // this is the main class and must be included to the main body.
$dr=new dataReader(); // creating a new instance of the class dataReader.
// this class gets the input text and uses the class LookupTable to find misspelt words.
$wrd="";
$j=0;
$i=0;


// instantiate new instance (from jsearchstring from phpclasses.org) to remove punctuation & wikiwords
$jSS=new jSearchString();

//output formatted string
$str = $jSS->parseString($body);

$str= strtolower($str);

$dr->reader($str);
}
// end of Spellcheck code}
else
{
%%

The ##handlers/page/edit.php## file was further altered by adding code for a "Spellcheck" button.....
%%(php)
//finish
// ORIGINAL LINE "<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
// Line below this has added spellcheck button (GMB)
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input name=\"submit\" type=\"submit\" value=\"Spellcheck\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose();
%%

The ##dictionary_class.php## file (provided at phpclasses) was modified to the following (and placed in the directory "spellchecker" in the wiki root).
%%(php)
<?php
//////////////////////////////// Dictionary class originally written by Reza Salehi. ////////////////////////////////////////////
//////////////////////////////// General Public License. ////////////////////////////////////////////
//////////////////////////////// zaalion@yahoo.com, http://zaalion.com ////////////////////////////////////////////
//////////////////////////////// tel : +98 912 2345463 ////////////////////////////////////////////
//////////////////////////////// Dec. 2004. ////////////////////////////////////////////
//////////////////////////////// JSearchString by Johan De Klerk from PHPCLASSES.org ////////////////////////////////////////////
//////////////////////////////// Modified by GMBowen for Wikka Wiki Dec. 2004 under GPL ////////////////////////////////////////////

class hashing
{
function hashFunction($str, $len)
{
$hash=0;
$l = strlen($str);

//step 1
for($i=0; $i<$l; $i++)
$hash+=ord($str[$i])*($i+1)*($i+1);

$hash*=ord($str[0]);
//step 2
$hash%=$len;

return($hash);
}
};

class lookupTable
{
var $MAX=6967;//6967
var $MaxWordLength=45;
var $dictionaryFile="spellchecker/dictionary.txt";
var $lookupTable;
var $MAXLen=16;

function initializeArray()
{
for($i=0; $i<$this->MAX; $i++)
for($j=0; $j<$this->MAXLen; $j++)
$this->lookupTable[$i][$j]=NULL;
}

function readToTable()
{
$this->initializeArray();

$buffer=""; $n=0;
$hash=new hashing();
$index=0;
$buffer="";
$count=0; $i=0;

$fp = fopen ("spellchecker/dictionary.txt", "r");
do
{
$buffer=fgets($fp, $this->MaxWordLength);
$buffer=trim($buffer);

$index=$hash->hashFunction($buffer, $this->MAX);
//---->read process
while($this->lookupTable[$index][$i]!=NULL)
$i++;
$this->lookupTable[$index][$i]=$buffer;
$i=0;
//<--- read process
}
while($buffer);

fclose($fp);
}

function isIn($str)
{
$h=new hashing();
$i=0;
$str=trim($str);
$temp="";

$index=$h->hashFunction($str, $this->MAX);
do
{
$temp=$this->lookupTable[$index][$i++];
if($temp==$str)
return(true);
}
while($temp!=NULL);

return(false);
}

function suggestion($str)
{
$count=0;
$index=-1;
$current=97;
$strC=$str;

for($i=0; $i<strlen($strC); $i++)
{
for($j=0; $j<26; $j++)
{
$strC[$i]= chr($current++);
if($this->isIn($strC))
{
if($count>0) print(" , ");
print($strC);
$count++;
}
}

$strC=$str;
$current=97;
}
return($count);
}
} ;

// modified by GMB from JsearchString
// obtained from phpclasses.org, written by Johan De Klerk released as "Freely Distributable"

class jSearchString {

// other words can be added to this string...probably all actions would be a good idea, and maybe code to list all wikipagenames?

var $wikiwords = array("{{google}}", "{{chat}}", "{{showcode}}", "{{hiddenpages}}", "CategoryWiki");

var $symbols = array('/','\\','\'','"',',','.','<','>','?',';',':','[',']','{','}','|','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');

function parseString($string) {
$string = ' '.$string.' ';
$string = $this->removeWikiwords($string);
$string = $this->removeSymbols($string);
return $string;
}

function removeWikiwords($string) {
for ($i = 0; $i < sizeof($this->wikiwords); $i++) {
$string = str_replace($this->wikiwords[$i],' ',$string);
}

//$string = str_replace(' ',' ',$string);
return trim($string);
}

function removeSymbols($string) {
for ($i = 0; $i < sizeof($this->symbols); $i++) {
$string = str_replace($this->symbols[$i],'',$string);
}

return trim($string);
}
};

class dataReader
{
function reader($strToCheck)
{
$lt=new lookupTable();
print("</p>Spellcheck....");
$lt->readToTable();
print("Completed!<br><br>");

$buffer="";
$words=explode(' ', $strToCheck);
$h=new hashing();
print("<b>These words are mis-spelled, suggestions for correct spellings are provided :<br></b>");
for($i=0; $i<count($words); $i++)
{
$buffer=$words[$i];

if(!($lt->isIn($buffer)))
{

print("<b>   ".$buffer." : </b>");
$sug=1; //added by GMB
if($sug)
$lt->suggestion($buffer);
print("<br>");
}
}
}
};
?>%%

The "dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.

""<a href="http://freelogs.com/stats/g/gmbowen/" target="_top"><img border="0" alt="Free Web Counter" src="http://xyz.freelogs.com/counter/index.php?u=gmbowen&s=a" ALIGN="middle" HSPACE="4" VSPACE="2"></a><script src=http://xyz.freelogs.com/counter/script.php?u=gmbowen></script>
<br><a style="font-size:12" href="http://free-web-directory.com/a/chadwicks/" target="_top"><font style="font-size:12" color="#666666">Chadwicks of Boston</font></a>""


----


Revision [4759]

Edited on 2005-01-17 14:53:10 by NilsLindenberg [cat. added]
Additions:
----
CategoryUserContributions
Deletions:


Revision [2868]

Edited on 2004-12-06 00:14:55 by GmBowen [a text-file based spellchecker for wikka (yay!) (Ver1.1)]
Additions:
The "dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.
Deletions:
The ""dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.


Revision [2867]

Edited on 2004-12-06 00:14:01 by GmBowen [a text-file based spellchecker for wikka (yay!) (Ver1.1)]
Additions:
The ""dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.
""<a href="http://freelogs.com/stats/g/gmbowen/" target="_top"><img border="0" alt="Free Web Counter" src="http://xyz.freelogs.com/counter/index.php?u=gmbowen&s=a" ALIGN="middle" HSPACE="4" VSPACE="2"></a><script src=http://xyz.freelogs.com/counter/script.php?u=gmbowen></script>
<br><a style="font-size:12" href="http://free-web-directory.com/a/chadwicks/" target="_top"><font style="font-size:12" color="#666666">Chadwicks of Boston</font></a>""
Deletions:
The ""dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.


Revision [2866]

Edited on 2004-12-05 23:46:41 by GmBowen [a text-file based spellchecker for wikka (yay!) (Ver1.1)]
Additions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words can be added or other dictionaries used instead.
Deletions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.


Revision [2865]

Edited on 2004-12-05 23:43:28 by GmBowen [a text-file based spellchecker for wikka (yay!)]]
Additions:
var $wikiwords = array("{{google}}", "{{chat}}", "{{showcode}}", "{{hiddenpages}}", "CategoryWiki");
Deletions:
var $wikiwords = array("{{google}}", "{{chat}}", "{{showcode}}", "{{test2}}", "{{hiddenpages}}", "CategoryWiki");


Revision [2864]

Edited on 2004-12-05 23:41:57 by GmBowen [a text-file based spellchecker for wikka (yay!)]
Additions:
This is code derived from a class released at [[http://www.phpclasses.org/browse/package/1992.html Php Classes]] as a generic PHP Spell Checker and is released under GPL for non-commercial uses. ''(Version 1.1 with improved punctuation & wikicode removal)''
If anyone wants to improve this spellchecker, I think it needs a "regular expression" thing (or something) added somewhere that....
- removes wiki pagenames
Other slight oddities also crop up (like two words being run together despite the space between them).
// instantiate new instance (from jsearchstring from phpclasses.org) to remove punctuation & wikiwords
$jSS=new jSearchString();
//output formatted string
$str = $jSS->parseString($body);
$str= strtolower($str);
// end of Spellcheck code}
//////////////////////////////// Dictionary class originally written by Reza Salehi. ////////////////////////////////////////////
//////////////////////////////// General Public License. ////////////////////////////////////////////
//////////////////////////////// zaalion@yahoo.com, http://zaalion.com ////////////////////////////////////////////
//////////////////////////////// tel : +98 912 2345463 ////////////////////////////////////////////
//////////////////////////////// Dec. 2004. ////////////////////////////////////////////
//////////////////////////////// JSearchString by Johan De Klerk from PHPCLASSES.org ////////////////////////////////////////////
//////////////////////////////// Modified by GMBowen for Wikka Wiki Dec. 2004 under GPL ////////////////////////////////////////////
// modified by GMB from JsearchString
// obtained from phpclasses.org, written by Johan De Klerk released as "Freely Distributable"
class jSearchString {
// other words can be added to this string...probably all actions would be a good idea, and maybe code to list all wikipagenames?
var $wikiwords = array("{{google}}", "{{chat}}", "{{showcode}}", "{{test2}}", "{{hiddenpages}}", "CategoryWiki");

var $symbols = array('/','\\','\'','"',',','.','<','>','?',';',':','[',']','{','}','|','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');

function parseString($string) {
$string = ' '.$string.' ';
$string = $this->removeWikiwords($string);
$string = $this->removeSymbols($string);
return $string;

function removeWikiwords($string) {
for ($i = 0; $i < sizeof($this->wikiwords); $i++) {
$string = str_replace($this->wikiwords[$i],' ',$string);
//$string = str_replace(' ',' ',$string);
return trim($string);

function removeSymbols($string) {
for ($i = 0; $i < sizeof($this->symbols); $i++) {
$string = str_replace($this->symbols[$i],'',$string);

return trim($string);
?>%%
Deletions:
This is code derived from a class released at [[http://www.phpclasses.org/browse/package/1992.html Php Classes]] as a generic PHP Spell Checker and is released under GPL for non-commercial uses.
If anyone wants to improve this, I think it needs a "regular expression" thing added somewhere that....
- removes all punctuation (my tool only works "sort of"), including wiki formatting codes
This will improve the spell check (which sometimes identifies words as mis-spelt because of non-letter characters)
$str= strtolower($body);
// code to remove non-letter characters and replace with a space
$ignorecode = Array ('/"/i', '/}/i', '/{/i', '/,/i', '/!/i', '/@/i', '/#/i', '/(/i', '/)/i', '/&/i', '/*/i', '/-/i', '/=/i', '/+/i');
$changeto = ' ';
$str = preg_replace($ignorecode, $changeto, $str);
// end of Spellcheck code
}
//////////////////////////////////////////// Dictionary class originally written by Reza Salehi. ////////////////////////////////////////////
//////////////////////////////////////////// General Public License. ////////////////////////////////////////////
//////////////////////////////////////////// zaalion@yahoo.com, http://zaalion.com ////////////////////////////////////////////
//////////////////////////////////////////// tel : +98 912 2345463 ////////////////////////////////////////////
//////////////////////////////////////////// Dec. 2004. ////////////////////////////////////////////
//////////////////////////////////////////// Modified by GMBowen for Wikka Wiki Dec. 2004 under GPL ////////////////////////////////////////////


Revision [2854]

Edited on 2004-12-04 23:13:17 by GmBowen [text-file based spell-checker for wikka (yay!!)]
Additions:
//finish
// ORIGINAL LINE "<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
// Line below this has added spellcheck button (GMB)
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input name=\"submit\" type=\"submit\" value=\"Spellcheck\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose();
Deletions:
// this class gets the input text and uses the class LookupTable to find misspelt words.
$i=0;


Revision [2853]

Edited on 2004-12-04 23:08:57 by GmBowen [text-based spell-checker for wikka (yay!!!)]
Additions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.
This will improve the spell check (which sometimes identifies words as mis-spelt because of non-letter characters)
$ignorecode = Array ('/"/i', '/}/i', '/{/i', '/,/i', '/!/i', '/@/i', '/#/i', '/(/i', '/)/i', '/&/i', '/*/i', '/-/i', '/=/i', '/+/i');
$changeto = ' ';
// this class gets the input text and uses the class LookupTable to find misspelt words.
$i=0;
$ignorecode = Array ('/"/i', '/}/i', '/{/i', '/,/i', '/!/i', '/@/i', '/#/i', '/(/i', '/)/i', '/&/i', '/*/i', '/-/i', '/=/i', '/+/i');
$changeto = ' ';
$words=explode(' ', $strToCheck);
Deletions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.
$ignorecode = Array ('/"/i', '/}/i', '/{/i', '/,/i', '/!/i', '/@/i', '/#/i', '/(/i', '/)/i', '/&/i', '/*/i', '/-/i', '/=/i', '/+/i');
$changeto = ' ';
// finish
// ORIGINAL LINE "<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
// line below added
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input name=\"submit\" type=\"submit\" value=\"Spellcheck\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose();
$words=explode(' ', $strToCheck);
?>


Revision [2852]

Edited on 2004-12-04 23:03:56 by GmBowen [text-based spell-checker for wikka (yay!!!)]
Additions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.
Deletions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.


Revision [2851]

Edited on 2004-12-04 23:03:24 by GmBowen [a text-file based spellchecker for wikka]
Additions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.
$ignorecode = Array ('/"/i', '/}/i', '/{/i', '/,/i', '/!/i', '/@/i', '/#/i', '/(/i', '/)/i', '/&/i', '/*/i', '/-/i', '/=/i', '/+/i');
$changeto = ' ';
// ORIGINAL LINE "<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input name=\"submit\" type=\"submit\" value=\"Spellcheck\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
$words=explode(' ', $strToCheck);
The ""dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now) and also must be placed in the "spellchecker" directory in the wikka root.
Deletions:
I don't doubt it is less "efficient" than those using packages that are "built into" the server, but it has the advantage that to set it up you don't need server root access, or the permission of your server provider. I'll also apologize that it is so "english" based, but the beauty of using this text-based file system is that non-English words added or other dictionaries used instead.
$ignorecode = Array ('/"/i', '/}/i', '/{/i', '/,/i', '/!/i', '/@/i', '/#/i', '/(/i', '/)/i', '/&/i', '/*/i', '/-/i', '/=/i', '/+/i');
$changeto = ' ';
// ORIGINAL LINE "<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input name=\"submit\" type=\"submit\" value=\"Spellcheck\" /> <input type=\"button\" value=\"Cancel\" onClick=\"document.location='".$this->href("")."';\" />\n".
$words=explode(' ', $strToCheck);
The ""dictionary.txt" file may either be downloaded from phpclasses, or is available from my server [[http://131.202.167.33/wiki/spellchecker/dictionary.txt here]] (at least for now).


Revision [2850]

The oldest known version of this page was created on 2004-12-04 22:37:58 by GmBowen [a text-file based spellchecker for wikka]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki