Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Fry-IT

Fry-IT is the company I work for

Photos

Photoalbum, both old and new.

Zope

What I have and am doing with Zope

Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 

Introducing django-spellcorrector

http://github.com/peterbe/django-spellcorrector/tree/master

27th of May 2009

I've now made a vastly improved spellcorrector specifically tied into Django and it's models. It's the old class as before but hooked up to models so Django can take care of persisting the trained words. Again, I have to give tribute to Peter Norvig for his inspirational blog How to Write a Spelling Corrector which a large majority of my code is based in. At least in the tricky parts.

What's nice about this little app is that it's very easy to plug in and use. You just download it, put it on your PATH and include it in your INSTALLED_APPS. Then from another app you do something like this:

 from spellcorrector.views import Spellcorrector
 sc = Spellcorrector()
 sc.load() # nothing will happen the first time

 sc.train(u"peter")
 print sc.correct(u"petter") # will print peter
 sc.save()

 sc2 = Spellcorrector()
 sc2.load()
 print sc2.correct(u"petter") # will print peter

This is my first django-*** app I've wrapped up and released in github so I'm not even near certain that I've done it right.

I'll try to keep the project updated and more approachable but right now it works in one of my production sites so I'm confident the code is ok.

Screenshots

Introducing django-spellcorrector

Introducing django-spellcorrector

Introducing django-spellcorrector



Comment

 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.