Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Andrew P
If it makes you feel any better, this isn't an easy problem to get 100% right, traditionally.  Heck, it might not even be possible.  A series of compromises might be  the best you can hope for. Some things to think about, however.  Can you choose the characters you want, instead of the (many, many

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Alan Gauld
> I have been using winpdb recently, it is a pretty decent standalone Python > debugger for Windows. http://www.digitalpeers.com/pythondebugger/ It looks the part and I've downloaded a copy. Thamks for the tip, Alan g ___ Tutor maillist - Tutor@py

[Tutor] Walk a dictionary recursively

2005-10-11 Thread Negroup -
Hi tutors, in my application I found convenient to store all the data in a data structure based on a dictionary containing a lot of keys, and each of them host other dictionary with lists and dictionaries nested inside and so on... First of all I'd like to know if it is normal to use so complex da

Re: [Tutor] Stopping function after given time

2005-10-11 Thread Raduz
On Monday 10 of October 2005 20:10, Oliver Maunder wrote: > > >Simple question: Is it possible to stop a running function after certain > > >predefined time? > > > > > >I would like to convert this routine to Python using pycurl module, or > > > > maybe > > > > >even standard urllib.urlretrieve. >

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Dick Moores
Thank you, Andrew, for your wise and thoughtful comments. Andrew P wrote at 23:58 10/10/2005: >If it makes you feel any better, this isn't an easy problem to get 100% >right, traditionally. Heck, it might not even be possible. A series of >compromises might be the best you can hope for. Yes,

Re: [Tutor] code improvement for beginner ?

2005-10-11 Thread Roel Schroeven
Kent Johnson wrote: > Roel Schroeven wrote: > >> Danny Yoo wrote: >> >> >>> Looking at pageimgs(): I'm not sure what 't' means in the open >>> statement: >>> >>> f = open(filename, "rt") >> >> It's not a typo. 't' opens the file in text mode. > > > Are you sure? Is that documented anywhere?

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Dick Moores
John Fouhy wrote at 14:47 10/10/2005: >Some comments: > > >textAsString = input.read() > >S = "" >for c in textAsString: > if c == "\n": > S += ' ' > else: > S += c > > >You could write this more concisely as: > >S = textAsString.replace('\n', ' ') Yes! Thanks. Tha

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Dick Moores
Kent Johnson wrote at 15:25 10/10/2005: >Dick Moores wrote: > > Specifically, I'm hoping for comments on or help with: > > 1) How to debug. I'm using v2.4, IDLE on Win XP. > >I have been using winpdb recently, it is a pretty decent standalone >Python debugger for Windows. Start it with the -t swi

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Dick Moores
Danny Yoo wrote at 15:47 10/10/2005: > > 3) No modularization. Couldn't see a reason to do so. Is there one or > > two? Specifically, what sections should become modules, if any? > > >Hi Dick, > >My recommendation is to practice using and writing functions. I certainly will, Danny. You've convinc

Re: [Tutor] Tutor Digest, Vol 20, Issue 37

2005-10-11 Thread Michael Lange
On Mon, 10 Oct 2005 17:07:47 -0600 Joseph Quigley <[EMAIL PROTECTED]> wrote: > Hi, > > Unfortunately I get this error: > > Exception in Tkinter callback > Traceback (most recent call last): > File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__ > return self.func(*args) > File "P

[Tutor] Please look at my wordFrequency.py (Alan Darwish)

2005-10-11 Thread iPlanetLDAP
Exceptional Python Ladies and Gents How about to make this great wordFrequency.py script to support Unicode/Locale wordFrequency.py for example this is an Arabic code page 1256 windows I guess it is a matter of character encoding. Try execute the following command before running wordFrequency.py

Re: [Tutor] Walk a dictionary recursively

2005-10-11 Thread Alan Gauld
> First of all I'd like to know if it is normal to use so complex data > structures in which store data, or if it possible in some way to > organize them using smaller "organizational units". Its not uncommon but often it can be simplified by using classes. In particular the classes can expose an

Re: [Tutor] Walk a dictionary recursively

2005-10-11 Thread paul brian
Firstly are you using this to store or alter data regarding Microsoft Active Directory?. If so I suggest you look at some of their ADSI / WMI interfaces for COM (if you use win32com from Mark Hammond or activeState life becomes a lot easier. Well the Windows programming part of it does) As for the

Re: [Tutor] Walk a dictionary recursively

2005-10-11 Thread Negroup -
2005/10/11, paul brian <[EMAIL PROTECTED]>: > Firstly are you using this to store or alter data regarding Microsoft > Active Directory?. If so I suggest you look at some of their ADSI / > WMI interfaces for COM (if you use win32com from Mark Hammond or > activeState life becomes a lot easier. Well

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Kent Johnson
Dick Moores wrote: > (Execution took about 30 sec. with my computer.) That's way too long > > Specifically, I'm hoping for comments on or help with: > 2) I've tried to put in remarks that will help most anyone to understand > what the code is doing. Have I succeeded? Yes, i think so > 3) No mo

[Tutor] Where is the error

2005-10-11 Thread enas khalil
hello, when i run the following code to Read and tokenize data from a tagged text as follows : from nltk.corpus import brownfrom nltk.tagger import TaggedTokenizerfrom nltk.tokenizer import *tagged_txt_str=open('corpus.txt' ).read()tagged_txt_token=Token(TEXT=tagged_txt_str)TaggedTokenizer.token

Re: [Tutor] Where is the error

2005-10-11 Thread Kent Johnson
What version of NLTK are you using? From a look at the API docs, nltk.tagger.TaggedTokenizer seems to have been removed in v1.4. Kent enas khalil wrote: > hello, > > > when i run the following code to Read and tokenize data from a > tagged text as follows : > > >

Re: [Tutor] AttributeError: 'str' object has no attribute, 'geturl'

2005-10-11 Thread Joseph Quigley
> You are welcome. This time I would like to help you but the code is > incomplete > (import error for Image) and I have never used urllib2 so I don't really know > what to > do. > Again, try to debug it with pdb. Place "import pdb; pdb.set_trace()" where > you want > the break point and see

Re: [Tutor] Where is the error

2005-10-11 Thread Alberto Troiano
Hi from nltk.tagger import TaggedTokenizer   I’m not familiar with this module but looking at the error it looks like the TaggedTokenizer module maybe misspelled or does not exists or the same with tagger Maybe an upcase letter or something like that Check your library for the correct

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Dick Moores
Kent Johnson wrote at 03:24 10/11/2005: >Dick Moores wrote: > > (Execution took about 30 sec. with my computer.) > >That's way too long How long would you expect? I've already made some changes but haven't seen the time change much. > > > > Specifically, I'm hoping for comments on or help with:

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Kent Johnson
Dick Moores wrote: > Kent Johnson wrote at 03:24 10/11/2005: > >>Dick Moores wrote: >> >>>(Execution took about 30 sec. with my computer.) >> >>That's way too long > > > How long would you expect? I've already made some changes but haven't > seen the time change much. A couple of seconds at mo

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Kent Johnson
Kent Johnson wrote: > Dick Moores wrote: > >> Kent Johnson wrote at 03:24 10/11/2005: >> >>> Dick Moores wrote: >>> (Execution took about 30 sec. with my computer.) >>> >>> >>> That's way too long >> >> >> >> How long would you expect? I've already made some changes but haven't >> seen the t

Re: [Tutor] code improvement for beginner ? (fwd)

2005-10-11 Thread Danny Yoo
-- Forwarded message -- Date: Tue, 11 Oct 2005 20:55:24 +0200 From: lmac <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re:code improvement for beginner ? Danny Yoo wrote: > >>>The point of this restructuring is to allow you to add more image >>>types without too

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Dick Moores
Kent Johnson wrote at 10:37 10/11/2005: >Kent Johnson wrote: > > Dick Moores wrote: > > > >> Kent Johnson wrote at 03:24 10/11/2005: > >> > >>> Dick Moores wrote: > >>> > (Execution took about 30 sec. with my computer.) > >>> > >>> > >>> That's way too long > >> > >> > >> > >> How long would y

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Kent Johnson
Dick Moores wrote: > Kent Johnson wrote at 10:37 10/11/2005: >>The reason psyco doesn't make much difference is because all the time is >>spent in list.count() which is already C code. > > > Ah. But how can I know what is in C code and what isn't? For example, in > a previous post you say that

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Andrew P
Just want to add a little something here, because reading over this thread, I think there may have been some confusion: Kent wrote: for e in saveRemovedForLaterL:    L.append(e)could be L.extend(e) I think he might have meant: for e in saveRemovedForLaterL:    L.append(e)could be L.extend(sav

Re: [Tutor] Please look at my wordFrequency.py

2005-10-11 Thread Kent Johnson
Andrew P wrote: > Just want to add a little something here, because reading over this > thread, I think there may have been some confusion: > > Kent wrote: > > for e in saveRemovedForLaterL: >L.append(e) > could be > L.extend(e) > > I think he might have meant: > > for e in saveRemovedForL

Re: [Tutor] code improvement for beginner ?

2005-10-11 Thread Scott Oertel
lmac wrote: > --- > >The problem with downloading the images is this: > >- >http://images.nfl.com/images/globalnav-shadow-gray.gif >Traceback (most recent call last): > File "/home/internet/bin/nflgrab.py", line 167, in ? >urllib.urlretrieve(img,img[f:]) > File "/usr/