[TriZPUG] A beginners question I am sure

Tim Arnold jtim.arnold at gmail.com
Sun Apr 3 01:36:38 CEST 2011


On Sat, Apr 2, 2011 at 7:28 PM, Ken M <ken at mack-z.com> wrote:

> I will try these shortly, thank you, direct link to file:
>
> http://www.gutenberg.org/dirs/etext96/pgwht04.txt
>
> I renamed it webster.txt for meaningfulness within my directory
> structure.
>
> Ken
>
> On Sat, 2011-04-02 at 19:06 -0400, Philip Semanchuk wrote:
> > On Apr 2, 2011, at 6:37 PM, Ken M wrote:
> >
> > > OK so working on a project (just started) that is for my own academic
> > > purposes for now.  Just trying to train myself in python.  The attached
> > > code snippet is to convert the websters dictionary (grab specific
> > > components) and insert them in a pipe delimmited data file for now.
> > > Next will be to a database.
> > >
> > > When I ran this for a 4.5 MB snippet of the file it worked fine, output
> > > file generated output good.  However when I run it for the entirety of
> > > the webster.txt file (45 MB) the program runs (well more apropos ends
> > > without any error message to me) but the output file I am creating is
> > > empty (0 bytes).
> > >
> > > The purpose for now is to build a subset dictionary file that is
> nothing
> > > more than word and the single letter initialism for word type (n =
> noun,
> > > v = verb, etc.)  Would appreciate insight into why this is not running
> > > to completion.  If anyone cares to know, I am running this on a Fedora
> > > 14 box, I edit and created my .py file with vim and my python
> > > installation is python-2.7-8.fc14.1.i686 (output from rpm -q python).
> >
> >
> > Coupla comments --
> >
> >
> > At the end, you have this:
> > fin.close
> > fout.close
> >
> > You forgot the parens:
> > fin.close()
> > fout.close()
> >
> > I don't know if that has anything to do with your lack of output.
> >
> > For debugging, I'd add this:
> >    print wordline
> > after this:
> >    fout.write(wordline)
> >
> > to get an idea of whether anything get processed at all.
> >
> >
> > And Pythonwise, I'd replace this:
> >     buildword = ''
> >     for x in tmpword:
> >         if x in string.ascii_lowercase:
> >             buildword = buildword + x
> >
> > With this:
> >     buildword = [char for char in tmpword if char in
> string.ascii_lowercase]
> >     buildword = ''.join(buildword)
> >
> >
> >
> > > P.S.  To save bandwidth I did not attach the webster.txt file however
> if
> > > anyone wanted to run this against it themselves it can be acquired
> > > through the Project Gutenberg site.
> >
> > Do you have a direct link?
> >
> >
> > Hope this helps
> > Philip
> >
>
>
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> http://mail.python.org/mailman/listinfo/trizpug
> http://trizpug.org is the Triangle Zope and Python Users Group
>

hi Ken,
I don't see any <pos> strings in that file.
--Tim Arnold
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/trizpug/attachments/20110402/86fd746a/attachment.html>


More information about the TriZPUG mailing list