Spell checking and Python

Discussion in 'Python' started by Gilles Lenfant, Dec 15, 2003.

  1. Hi pythonists,

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

    Many thanks by advance

    --
    Gilles
     
    Gilles Lenfant, Dec 15, 2003
    #1
    1. Advertising

  2. Gilles Lenfant

    Dave Kuhlman Guest

    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
     
    Dave Kuhlman, Dec 16, 2003
    #2
    1. Advertising

  3. 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/Cookbook/Python/Recipe/117221


    Cheers,
    Martin.
    --
    Martin Franklin <>
     
    Martin Franklin, Dec 16, 2003
    #3
  4. "Gilles Lenfant" <> a écrit dans le message de
    news:brl2vb$1dj$...
    > 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
     
    Gilles Lenfant, Dec 16, 2003
    #4
  5. Gilles Lenfant

    JanC Guest

    "Gilles Lenfant" <> 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
     
    JanC, Dec 17, 2003
    #5
  6. "JanC" <> a écrit dans le message de
    news:Xns945447CD5CFE9JanC@213.119.4.35...
    > "Gilles Lenfant" <> 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
     
    Gilles Lenfant, Dec 17, 2003
    #6
  7. Gilles Lenfant

    Jarek Zgoda Guest

    JanC <> 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-python-1.0-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: http://zgoda.jogger.pl/
     
    Jarek Zgoda, Dec 17, 2003
    #7
  8. Gilles Lenfant

    Ken Godee Guest

    Jarek Zgoda wrote:

    > JanC <> 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-python-1.0-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?
     
    Ken Godee, Dec 17, 2003
    #8
  9. Jarek Zgoda wrote:

    > Maybe myspell-python?
    >
    > http://www.zgoda.biz/dnld/myspell-python-1.0-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")
     
    William Trenker, Dec 18, 2003
    #9
  10. Gilles Lenfant

    Jarek Zgoda Guest

    William Trenker <> 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: http://zgoda.jogger.pl/
     
    Jarek Zgoda, Dec 19, 2003
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pater Maximus
    Replies:
    1
    Views:
    348
    Ian Parker
    Oct 20, 2004
  2. Tim Golden
    Replies:
    1
    Views:
    342
    Pater Maximus
    Oct 20, 2004
  3. Tim Golden
    Replies:
    2
    Views:
    458
    Roger Upole
    Oct 21, 2004
  4. Tim Golden
    Replies:
    1
    Views:
    432
    Pater Maximus
    Oct 25, 2004
  5. John Zenger

    Spell-checking Python source code

    John Zenger, Sep 8, 2007, in forum: Python
    Replies:
    9
    Views:
    564
    David
    Sep 10, 2007
Loading...

Share This Page