Okay Heres the problem: in Index

Paul McGuire ptmcg at austin.stopthespam_rr.com
Wed Mar 10 09:55:51 EST 2004


To do this for every word, build a Set of found words as you read through
the e-mail (import the sets module to get the Set class) - a Set will not
duplicate any entries, so when you are done, the Set will contain every
individual word from the e-mail.  Then follow Miki's instruction for each
word in the Set.

"dont bother" <dontbotherworld at yahoo.com> wrote in message
news:mailman.210.1078905376.19534.python-list at python.org...
> Hey Miki,
> I have to do this for everyword that is occuring.
> Its not that , that I have to do this only for the
> word "syntax". How can I do this for every word. I
> want a general solution that can work.
> Any ones game for this?
> Thanks A ton though,
> Dont
>
> > > 1. The numbers 0, 1, 2, 3, that are in the output
> > of
> > > the vector.py are the corresponding position of
> > the
> > > words in the email_message, that I ran against the
> > > dictionary_index. I want the index of the
> > > corresponding word in the dictionary. For example:
> > If
> > > "syntax" was occuring in the dictionary at 500. I
> > want
> > > the 500 syntax <value> instead of 6 syntax <value>
> > > that I am getting right now.
> > When you load the dictionary just remember the line
> > of each "syntax" and
> > print it later.
> >
> > --- *not tested* ---
> > syntax = {}
> > lines = {}
> > for lnum, line in enumerate(open("dictionary.txt")):
> >      val, syn = line.strip().split(":")
> >      syntax[syn] = long(val)
> >      lines[syn] = lnum
> > ---
> >
> > > 1 index value index value index value index value
> > > index value
> > I don't see the problem here.
> >
> > HTH.
> > Miki
> > --
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you're looking for faster
> http://search.yahoo.com
>





More information about the Python-list mailing list