473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Spell checking and Python

Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell ?) with a
Python app ?

Many thanks by advance

--
Gilles
Jul 18 '05 #1
9 3984
Gilles Lenfant wrote:
Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell
?) with a Python app ?

Many thanks by advance


Here is one way for UNIX/Linux running with X Windows:

def check(content):
file = open('ispell.tmp', 'w')
file.write(content)
file.close()
os.system('xterm -e ispell ispell.tmp')
file = open('ispell.tmp', 'r')
content = file.read()
file.close()
return content
You might want to use the tempfile module in the Python standard
library to create the temporary file, though.

Dave

--
http://www.rexx.com/~dkuhlman
dk******@rexx.com
Jul 18 '05 #2
On Mon, 2003-12-15 at 19:46, Gilles Lenfant wrote:
Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell ?) with a
Python app ?

Many thanks by advance

--
Gilles


quick google for python cookbook then search for spell produces this:-
http://aspn.activestate.com/ASPN/Coo.../Recipe/117221
Cheers,
Martin.
--
Martin Franklin <mf********@gatwick.westerngeco.slb.com>
Jul 18 '05 #3

"Gilles Lenfant" <gl******@NOSPAM.bigfoot.com> a écrit dans le message de
news:br**********@biggoron.nerim.net...
Hi pythonists,

Any experience or pointer on using a spell checker (aspell, ispell ?) with a Python app ?

Many thanks by advance

And many thanks to all afterwards...

--
Gilles
Jul 18 '05 #4
"Gilles Lenfant" <gl******@NOSPAM.bigfoot.com> schreef:
Any experience or pointer on using a spell checker (aspell, ispell ?)
with a Python app ?


Maybe snakespell: <http://www.scriptfoundry.com/modules/snakespell/>

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #5

"JanC" <us*********@janc.invalid> a écrit dans le message de
news:Xn******************@213.119.4.35...
"Gilles Lenfant" <gl******@NOSPAM.bigfoot.com> schreef:
Any experience or pointer on using a spell checker (aspell, ispell ?)
with a Python app ?


Maybe snakespell: <http://www.scriptfoundry.com/modules/snakespell/>

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9


Great... Many thanks JanC

--
Gilles
Jul 18 '05 #6
JanC <us*********@janc.invalid> pisze:
Any experience or pointer on using a spell checker (aspell, ispell ?)
with a Python app ?


Maybe snakespell: <http://www.scriptfoundry.com/modules/snakespell/>


Maybe myspell-python?

http://www.zgoda.biz/dnld/myspell-py...minimal.tar.gz

This is repackaged original library by Karl W. MacMillan. I finally
found a maitainer for this piece of code and I hope it will be actively
developed.

--
Jarek Zgoda
Unregistered Linux User # -1
http://www.zgoda.biz/ JID:zg***@chrome.pl http://zgoda.jogger.pl/
Jul 18 '05 #7
Jarek Zgoda wrote:
JanC <us*********@janc.invalid> pisze:

Any experience or pointer on using a spell checker (aspell, ispell ?)
with a Python app ?


Maybe snakespell: <http://www.scriptfoundry.com/modules/snakespell/>

Maybe myspell-python?

http://www.zgoda.biz/dnld/myspell-py...minimal.tar.gz

This is repackaged original library by Karl W. MacMillan. I finally
found a maitainer for this piece of code and I hope it will be actively
developed.


I recently (july) wrote a small spell check program using
myspell-python and thought it was far better than anything out
there and then it seemed to just drop off the face of the planet.
Where do you think it's going to be maintained so I can book mark it?

Jul 18 '05 #8
Jarek Zgoda wrote:
Maybe myspell-python?

http://www.zgoda.biz/dnld/myspell-py...minimal.tar.gz

This is repackaged original library by Karl W. MacMillan. I finally
found a maitainer for this piece of code and I hope it will be actively
developed.


Might want to apply the following patch to __init__.py so that the dictionary files are located relative to the installation directory. When I first tried running myspell-python (Linux Python 2.3.2) I got a traceback -- the dictionary path was wrong compared with where setup.py actually installed the dictionaries.

After the fix, myspell-python worked very well. The list of suggested spellings for a given word is quite good.

Bill

--- __init__.py-original Wed Jun 11 13:41:23 2003
+++ __init__.py Thu Dec 18 13:18:24 2003
@@ -39,7 +39,7 @@
# break on other platforms.
self.dicts_path = sys.prefix + "/myspell-dicts/"
if sys.platform != 'win32':
- self.dicts_path = "/usr/share/myspell-dicts/"
+ self.dicts_path = sys.prefix + "/share/myspell-dicts/"
core.MySpellBase.__init__(self, self.dicts_path + "en_US.aff",
self.dicts_path + "en_US.dic")

Jul 18 '05 #9
William Trenker <wt******@shaw.ca> pisze:
Might want to apply the following patch to __init__.py so that the
dictionary files are located relative to the installation directory.
When I first tried running myspell-python (Linux Python 2.3.2) I got a
traceback -- the dictionary path was wrong compared with where
setup.py actually installed the dictionaries.

After the fix, myspell-python worked very well. The list of suggested
spellings for a given word is quite good.


Of course, all pathes, fixes and suggestions are welcome. I hope that
this piece of code finally find it's safe harbor at Savannah or SF. I
think that other people also find it worth using.

--
Jarek Zgoda
Unregistered Linux User # -1
http://www.zgoda.biz/ JID:zg***@chrome.pl http://zgoda.jogger.pl/
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pater Maximus | last post by:
I want to use the MS Word spell checker from my Python program. I check the spelling a word at a time. It works fine for English but I can not force it to use French when I am using that language....
84
by: Andy Glew | last post by:
I am in search of any rigourous, scientific, academic or industrial studies comparing naming conventions in C++ or similar languages such as Ada: Specifically, are names formed with...
1
by: Lloyd Dupont | last post by:
I see that outlook express has some spell checking capacity. so I though maybe there is a spell checking feature available in windows. the only thing I found out requires word2003, which is to big...
12
by: Ryan | last post by:
Is there anyway to enable spell-checking for user input in a Text Box? Either auto spell-check or create a spell-check button. Using VB 2005.
6
by: Neil | last post by:
Is there way to have control over the MS-Access spell checking (besides just launching it)? We want to tell it to check all records, but skip certain fields (or, alternatively, ONLY check certain...
9
by: John Zenger | last post by:
To my horror, someone pointed out to me yesterday that a web app I wrote has been prominently displaying a misspelled word. The word was buried in my code. Is there a utility out there that...
5
by: Dean Slindee | last post by:
Anybody got any helpful suggestions on how to implement spell checking in a textbox. Perhaps solutions using Microsoft Word spell checker as a called routine? What has worked for you? Thanks,...
22
by: SmokeWilliams | last post by:
Hi, I am working on a Spell checker for my richtext editor. I cannot use any open source, and must develop everything myself. I need a RegExp pattern to split text into a word array. I have...
4
by: BillE | last post by:
I have found articles on line about using word interop for spell checking with visual studio applications. Most of the articles are several years old, though - VS2003, maybe 2005. I couldn't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.