thank you very much, very clear explanation, I will try with the beginner Phyton tutorials. carme
2008/10/17 Alan Gauld <[EMAIL PROTECTED]> > "carme colominas" <[EMAIL PROTECTED]> wrote > it > >> I'm a linguist and absolut new on Python; I'm trying to follow the first >> chapter of *Natural Language Processing in Python. >> > > I'm not familiar witrh it but if the code you have is from the first > chapter then I suggest you should go through one of the beginner > Python tutorials first. > > You don't say whether you know any other programjing languages > but from your question it doesn't look like it so I'll suggest you > try the Non Programmers tutorials: > > http://wiki.python.org/moin/BeginnersGuide/NonProgrammers > > what does it mean that a function is not defined >> and how to proceed? >> > > Traceback (most recent call last): >> File "<pyshell#47>", line 2, in <module> >> if fdist(word)>= 3: >> NameError: name 'fdist' is not defined >> > > Note that it doesn't say the function is not defined it says > the *name* is not defined. That's a different thing. These > kinds of details matter in programming. > > A name can be as variable or a function or a class or > a module or most any other kind of object in Python. > Names have to be created before they are used in Python. > In this case it is a function and we create it by defining > the function or by importing the function from another module. > The other possibility is to access it from another module > which we have already imported - like you did with the > words() function: > > nltk.corpus.brown.words() > > You may just need to preface the fdist() function with the > name of the module where it is defined. > > But all of this will makemuch more sense if you go through > one of the tutorials on the link above. > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.freenetpages.co.uk/hp/alan.gauld > > _______________________________________________ > Tutor maillist - [email protected] > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
