[Tutor] Fwd: thesaurus

Pete Froslie froslie at gmail.com
Thu Jul 9 04:41:56 CEST 2009


I see.. that makes sense. Kind of new with python -- sorry for that.

after printing using this:

print urllib.urlopen('
http://words.bighugelabs.com/api/2/e413f24801aa30b8d441ca43a64317be/moving/').read(
)

I'm getting a format like this returned:

adjective|sim|streaming
adjective|sim|swirling
adjective|sim|tossing
adjective|sim|touching
adjective|sim|touring
adjective|sim|traveling
adjective|sim|tumbling

I assume I need to clean this up by reading past  'Adjective|sim|' to
'streaming' and then returning it from lookup()..
this will be happening in the following:

urllib.urlopen('
http://words.bighugelabs.com/api/2/e413f24801aa30b8d441ca43a64317be/moving/').read(SOMETHINGHERE)



On Wed, Jul 8, 2009 at 10:29 PM, Rich Lovely <roadierich at googlemail.com>wrote:

> 2009/7/9 Pete Froslie <froslie at gmail.com>:
> > No problem, thanks for taking the time.
> >
> > I'm actually trying to resolve this error now:
> >
> >    buff.append(" ".join(lookup(Word) for Word in line.split()))
> > NameError: global name 'lookup' is not defined
> >
> > ..also assume I need to change 'Word' to something that checks the next
> word
> > in the text file and then replaces it with the one that is looked up..
> > working on that now.
> >
> > Pete F
>
> lookup() is the function that looks up the word in the thesaurus.  I
> left implementing that as an exercise for you, as I don't know the
> format of the reference you're using.
> --
> Richard "Roadie Rich" Lovely, part of the JNP|UK Famile
> www.theJNP.com
>



-- 
Pete Froslie
617.314.0957
http://www.froslie.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090708/143faa39/attachment.htm>


More information about the Tutor mailing list