Spell checking and Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gilles Lenfant

    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


  • Dave Kuhlman

    #2
    Re: Spell checking and Python

    Gilles Lenfant wrote:
    [color=blue]
    > Hi pythonists,
    >
    > Any experience or pointer on using a spell checker (aspell, ispell
    > ?) with a Python app ?
    >
    > Many thanks by advance[/color]

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

    def check(content):
    file = open('ispell.tm p', 'w')
    file.write(cont ent)
    file.close()
    os.system('xter m -e ispell ispell.tmp')
    file = open('ispell.tm p', '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



    --

    dkuhlman@rexx.c om

    Comment

    • Martin Franklin

      #3
      Re: Spell checking and Python

      On Mon, 2003-12-15 at 19:46, Gilles Lenfant wrote:[color=blue]
      > Hi pythonists,
      >
      > Any experience or pointer on using a spell checker (aspell, ispell ?) with a
      > Python app ?
      >
      > Many thanks by advance
      >
      > --
      > Gilles[/color]

      quick google for python cookbook then search for spell produces this:-





      Cheers,
      Martin.
      --
      Martin Franklin <mfranklin1@gat wick.westerngec o.slb.com>


      Comment

      • Gilles Lenfant

        #4
        Re: Spell checking and Python


        "Gilles Lenfant" <glenfant@NOSPA M.bigfoot.com> a écrit dans le message de
        news:brl2vb$1dj $1@biggoron.ner im.net...[color=blue]
        > Hi pythonists,
        >
        > Any experience or pointer on using a spell checker (aspell, ispell ?) with[/color]
        a[color=blue]
        > Python app ?
        >
        > Many thanks by advance[/color]


        And many thanks to all afterwards...

        --
        Gilles


        Comment

        • JanC

          #5
          Re: Spell checking and Python

          "Gilles Lenfant" <glenfant@NOSPA M.bigfoot.com> schreef:
          [color=blue]
          > Any experience or pointer on using a spell checker (aspell, ispell ?)
          > with a Python app ?[/color]

          Maybe snakespell: <http://www.scriptfound ry.com/modules/snakespell/>

          --
          JanC

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

          Comment

          • Gilles Lenfant

            #6
            Re: Spell checking and Python


            "JanC" <usenet_spam@ja nc.invalid> a écrit dans le message de
            news:Xns945447C D5CFE9JanC@213. 119.4.35...[color=blue]
            > "Gilles Lenfant" <glenfant@NOSPA M.bigfoot.com> schreef:
            >[color=green]
            > > Any experience or pointer on using a spell checker (aspell, ispell ?)
            > > with a Python app ?[/color]
            >
            > Maybe snakespell: <http://www.scriptfound ry.com/modules/snakespell/>
            >
            > --
            > JanC
            >
            > "Be strict when sending and tolerant when receiving."
            > RFC 1958 - Architectural Principles of the Internet - section 3.9[/color]

            Great... Many thanks JanC

            --
            Gilles


            Comment

            • Jarek Zgoda

              #7
              Re: Spell checking and Python

              JanC <usenet_spam@ja nc.invalid> pisze:
              [color=blue][color=green]
              >> Any experience or pointer on using a spell checker (aspell, ispell ?)
              >> with a Python app ?[/color]
              >
              > Maybe snakespell: <http://www.scriptfound ry.com/modules/snakespell/>[/color]

              Maybe myspell-python?



              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:zgoda@chrom e.pl http://zgoda.jogger.pl/

              Comment

              • Ken Godee

                #8
                Re: Spell checking and Python

                Jarek Zgoda wrote:
                [color=blue]
                > JanC <usenet_spam@ja nc.invalid> pisze:
                >
                >[color=green][color=darkred]
                >>>Any experience or pointer on using a spell checker (aspell, ispell ?)
                >>>with a Python app ?[/color]
                >>
                >>Maybe snakespell: <http://www.scriptfound ry.com/modules/snakespell/>[/color]
                >
                >
                > 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.
                >[/color]

                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?



                Comment

                • William Trenker

                  #9
                  Re: Spell checking and Python

                  Jarek Zgoda wrote:
                  [color=blue]
                  > 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.[/color]

                  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.MySpellBas e.__init__(self , self.dicts_path + "en_US.aff" ,
                  self.dicts_path + "en_US.dic" )

                  Comment

                  • Jarek Zgoda

                    #10
                    Re: Spell checking and Python

                    William Trenker <wtrenker@shaw. ca> pisze:
                    [color=blue]
                    > 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.[/color]

                    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:zgoda@chrom e.pl http://zgoda.jogger.pl/

                    Comment

                    Working...