Okay Heres the problem: in Index

dont bother dontbotherworld at yahoo.com
Wed Mar 10 02:56:13 EST 2004


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