MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

[brundage@laurel.ipac.caltech.edu: Re: dictionary server?]



------- Start of forwarded message -------
Return-Path: nop@ccs.neu.edu
Date: Tue, 11 Mar 1997 12:56:38 PST
From: Michael Brundage <brundage@laurel.ipac.caltech.edu>
To: Kimberly Bobrow <kbobrow@parc.xerox.com>
cc: MOO-COWS <moo-cows@parc.xerox.com>,
        Jacqueline Hamilton <kira@metronet.com>
Subject: Re: dictionary server?
In-Reply-To: <199703111950.OAA20052@soho.ios.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: MOO-Cows-Errors@parc.xerox.com
Precedence: bulk
Resent-From: clue-cows <nop@nop.com>
Errors-To: clue-cows <nop@nop.com>

On Tue, 11 Mar 1997, Kimberly Bobrow wrote:
> >We've got scrabble on our MOO and had a "lookup" verb that would query the
> >dictionary server at citi.umich.edu 2627.  However that server seems to
> >have up and died, and I'm having a hard time finding any others.  Anyone
> >know of a non-web-based dictionary server I can point to?
> 
> I have the same habit, and the same problem, and also haven't been
> able to find anything...the old one got 'upgraded' to a web version -
> bleah!

I wrote something a year or so ago to stip the html off of one particular 
webbed dictionary I found, and posted it to moo-cows then.  It's not robust 
against changes to the format of the pages served by the dictionary 
(which may not even be up and running anymore) and assumes onc() returns 
an error instead of raising one.  But, it worked for me at the time, and 
was just a quick hack anyway.   Feel free to modify/use/distribute it at will:

@webster  any none none

"Usage: @webster <word>";
"Looks up the definition, etc. of the word using an online dictionary.";
"Does anyone know an online dictionary without all the HTML garbage?";
"Author: Michael Brundage";
if (args && (word = args[1]))
  if (typeof(e = open_network_connection("c.gp.cs.cmu.edu", 5103)) == ERR)
    e = {"network error", "outbound connections disabled", "connection refused", "resource limit exceeded"}[(e in {E_PERM, E_INVARG, E_QUOTA}) + 1];
    player:tell(tostr("Unable to lookup a definition for ", word, " (", e, ").") );
  else
    add = 0;
    notify(e, "GET /prog/webster?" + args[1]);
    while (typeof(line = read(e)) == STR)
      if (index(line, "Webster Definition"))
        add = 1;
      elseif (index(line, "Additional Lookup"))
        add = 0;
      endif
      if (add)
        "Taken from $web.utils:puree(line) on moo://math.washington.edu:7776/";
        if (line in {"<P>", "<p>", "<br>", "<BR>"})
          player:tell("");
        elseif (line in {"<HR>", "<hr>"})
          player:tell($string_utils:space(79, "-"));
        endif
        while (m = match(line, "%(.*%)<%([^<>]*%)>%(.*%)"))
          line = substitute("%1%3", m);
        endwhile
        player:tell(line);
      endif
    endwhile
    boot_player(e);
  endif
else
  player:tell("Usage: @webster <word>");
endif




Cheers,

michael
brundage@ipac.caltech.edu
------- End of forwarded message -------


Home | Subject Index | Thread Index