# \[PHP\] Spell Check

**URL:** <https://forum.kirupa.com/t/php-spell-check/65499>\
**Category:** programming\
**Created:** [September 27, 2004, 4:15am UTC](https://forum.kirupa.com/t/php-spell-check/65499 "2004-09-27T04:15:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitgeorge](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@amitgeorge](https://forum.kirupa.com/u/amitgeorge)\
**Post date:** [September 27, 2004, 4:15am UTC](https://forum.kirupa.com/t/php-spell-check/65499/1 "2004-09-27T04:15:27Z")

</div>

Has anybody implemented a spell check in PHP ?

which ones are available ? open source or any other ?

or if anybody has some code that would be fantastic.  
:puzzle:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2004, 3:29pm UTC](https://forum.kirupa.com/t/php-spell-check/65499/2 "2004-09-28T15:29:49Z")

</div>

i dont see why this is technically difficult. all you need is an array of words and spelling checking by means of searching a word in the array.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 29, 2004, 6:11am UTC](https://forum.kirupa.com/t/php-spell-check/65499/3 "2004-09-29T06:11:23Z")

</div>

but how will you suggest correct words ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 29, 2004, 6:23am UTC](https://forum.kirupa.com/t/php-spell-check/65499/4 "2004-09-29T06:23:42Z")

</div>

That’s hard but not difficult you get them out of a MySQL database and only check the first 5 chracters… then check. or write down all the posibilities for wrong words,

Gmail has a spellings check.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 29, 2004, 3:20pm UTC](https://forum.kirupa.com/t/php-spell-check/65499/5 "2004-09-29T15:20:56Z")

</div>

try this: [http://aspell.sourceforge.net/](http://aspell.sourceforge.net/)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 29, 2004, 3:35pm UTC](https://forum.kirupa.com/t/php-spell-check/65499/6 "2004-09-29T15:35:37Z")

</div>

Weelll… Google makes its spellchecker available as a web service. I can’t go into the details of using it because I’ve never used web services before, but you could look into it 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2004, 3:06am UTC](https://forum.kirupa.com/t/php-spell-check/65499/7 "2004-09-30T03:06:09Z")

</div>

> [@amitgeorge](#):
>
> but how will you suggest correct words ?

since you asked this, i gave it some thought. this will be more of a computer science question. implementing it in php is another part of the problem.

option 1, you could try above suggestions.  
option 2, you could reinvent the wheels.

common spelling errors include,  
taht … adjacent letter swapped  
somthing … missing letter  
frase, klear … sound similar, … hmmm stuff  
throught … thought or through, extra letter  
thon … thin? because o is next to i.  
etc etc

you can  
1, compile a list of commonly misspelled ‘words’.  
2, or, transform a misspelled ‘word’ according to how it might be misspelled, then search it in word-list again.  
3, or, formulate a mathematical space, a word is a point in this space. assign a distance function on the space so that two similar words have short distance in between.  
4, or google ‘spelling check implementation’

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2004, 4:38am UTC](https://forum.kirupa.com/t/php-spell-check/65499/8 "2004-09-30T04:38:08Z")

</div>

Thanks all you guys…

aspell is a pretty good option… i will check it out…

eirche

> [@eirche](#):
>
> option 2, you could reinvent the wheels.

Immidiately this is not an option but this is interesting…

> [@eirche](#):
>
> 1, compile a list of commonly misspelled ‘words’.

i dont think so… I mean look at the database size… there are 800,000 words in english… how many misspleed words might be there ? and who is going to enter them in the database ?

> [@eirche](#):
>
> 3, or, formulate a mathematical space, a word is a point in this space. assign a distance function on the space so that two similar words have short distance in between.

This seems to be a good option… But maybe it needs more discussion…

> [@eirche](#):
>
> 4, or google ‘spelling check implementation’

This is just an interface implementation… first we need to program the backend…
