Introducing django-spellcorrector

28 May 2009   0 comments   Django

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

Mind That Age!

This blog post is 8 years old! Most likely, its content is outdated. Especially if it's technical.

Powered by Fusion×

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

Follow @peterbe on Twitter

Comments

Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
Crossing the world - new feature on Crosstips 23 May 2009
Next:
My dislike for booleans and that impact on the Django Admin 01 June 2009
Related by Keyword:
gg - A prototype to rule Git, GitHub and Bugzilla 06 May 2016
How I git 18 June 2015
GitHub PR triage across multiple projects 28 April 2014
Github Pull Request Triage tool 06 March 2014
Gamification for me as a software developer 21 December 2012
Related by Text:
Real-timify Django with SockJS 06 September 2012
Cryptic errors when using django-nose 07 December 2011
Musings about django.contrib.auth.models.User 28 August 2010
How and why to use django-mongokit (aka. Django to MongoDB) 08 March 2010
String comparison function in Python (alpha) 22 December 2007