Re: ignore specific data

2005-11-21 Thread pkilambi
I tried the solutions you provided..these are not as robust as i thought would be... may be i should put the problem more clearly... here it goes I have a bunch of documents and each document has a header which is common to all files. I read each file process it and compute the frequency of w

Re: ignore specific data

2005-11-21 Thread pkilambi
thanks for that. But this will check for the exact content of the "start of block.." or "end of block". How about if the content is anywhere in the line? -- http://mail.python.org/mailman/listinfo/python-list

ignore specific data

2005-11-21 Thread pkilambi
Hi I need help. What I want to do is If I read a file with some text content... I would like to ignore a block of lines and consider the rest.. so if the block starts with "start of block." fjesdgsdhfgdlgjklfjdgkd jhcsdfskdlgjkljgkfdjkgj "end of block" I want to ignore this while proc

Re: help make it faster please

2005-11-10 Thread pkilambi
ok this sounds much better..could you tell me what to do if I want to leave characters like @ in words.So I would like to consider this as a part of word -- http://mail.python.org/mailman/listinfo/python-list

Re: help make it faster please

2005-11-10 Thread pkilambi
Actually I create a seperate wordlist for each so called line.Here line I mean would be a paragraph in future...so I will have to recreate the wordlist for each loop -- http://mail.python.org/mailman/listinfo/python-list

Re: help make it faster please

2005-11-10 Thread pkilambi
Oh sorry indentation was messed here...the wordlist = countDict.keys() wordlist.sort() should be outside the word loop now def create_words(lines): cnt = 0 spl_set = '[",;<>{}_&?!():-[\.=+*\t\n\r]+' for content in lines: words=content.split() countDict={} wor

help make it faster please

2005-11-10 Thread pkilambi
I wrote this function which does the following: after readling lines from file.It splits and finds the word occurences through a hash table...for some reason this is quite slow..can some one help me make it faster... f = open(filename) lines = f.readlines() def create_words(lines): cnt = 0

Searching files in directories

2005-10-14 Thread pkilambi
can anyone help me with this... I want to search for a list for files in a given directory and if it exists copy them to destination directory so what i am looking for is : file = 'file1.txt' source_directory = '/tmp/source/' destination_directory = '/tmp/destination/' so If the file exist

Re: grouping array

2005-09-30 Thread pkilambi
fredrick's solutions seems to be more closer to what I was looking for.But I am still not sure if that could be done without the use of Image module. Also in your solution I cannot follow this [[1, 1, 2, 1, 2, 0], [2, 0, 0, 2, 0, 1], [1, 2, 2, 0, 2, 0], [0, 1, 0, 0, 0, 0], [2, 0, 0, 1,

Re: grouping array

2005-09-29 Thread pkilambi
1. why are you creating an Image object here? cant this be done by handling lists? 2. What exactly is getprojection doing? -- http://mail.python.org/mailman/listinfo/python-list

Re: grouping array

2005-09-29 Thread pkilambi
sure: basically I am looking for clustering of non zero groups in that 2D list...so in the above array the first non zero cluster is 2,2 in row 0, 1,1 in row 1 and 1,1 in row 1 so if we think of this as one group we have the first element of the group is at (0,0) in the list and last is at (2,1) in

grouping array

2005-09-29 Thread pkilambi
hi if I have an array say x = [[2,2,0,0,1,1], [1,1,0,0,1,1], [1,1,0,0,1,1]] I basically want to group regions that are non zero like I want to get the coordinates of non zero regions..as (x1,y1,x2,y2) [(0,0,2,1),(0,4,2,5)] which show the top left(x1,y1) and bottom right(x2,y2) co