| Store | Cart

Okay Heres the problem: in Index

From: Miki Tebeka <miki...@zoran.com>
Wed, 10 Mar 2004 08:28:16 +0200
Hello,


> 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

Recent Messages in this Thread
Miki Tebeka Mar 10, 2004 06:28 am