SDict.mesa - Interface for simple dictionary service
Last Edited by: Hthompson, September 7, 1983 11:39 am
Last Edited by: Kay, August 30, 1983 4:53 PM
DIRECTORY
Rope USING [ ROPE ];
SDict: DEFINITIONS =
BEGIN
Functions
Text: PROC [Stream: Rope.ROPE]
RETURNS
 [RetrievedItem: Rope.ROPE];
Text is the procedure used to supply a piece of text to the server. The
RetrievedItem returned serves as a handle to the text
in calls to Retrieve.
Text raises no signals.
The text supplied will be flushed and the handle go stale if not used for some period, currently 1 minute.
Retrieve: PROC [Item: Rope.ROPE, Relation: ATOM]
RETURNS
 [RetrievedItem: Rope.ROPE];
Retrieve takes an Item and a Relation. If another item stands in the Relation to the given Item, it is returned as the RetrievedItem.
If the item is a stale text item, or requires reference to one,
the NoText signal (q.v.) will be raised.
If no item stands in the relation to the given item, the error Empty will be raised.
If the item supplied is ill-formed (counterfeit), the error DictFailed with argument HandleError will be raised.
If Relation is undefined for the type of item supplied, the error DictFailed with argument ArgError will be raised. (Note that this is not the same case as Empty, which means the relation is well-defined but happens not to be filled).
The attempt to retrieve an Entry from Text will cause the NotFound error to be raised if no entry can be found for the string in the dictionary. It has two arguments, the word itself, and its position in the text.
The attempt to retrieve an Entry from Text will cause the signal MorphCorrection (q.v.) to be raised if a correctable error is detected in the morphology of a word, e.g. "traumas" instead of "traumata".
The following table gives the currently
implemented types of items and the relations they contract.

Text  Next    Text
Text  Entry    Entry
Entry Next    Entry    
Entry Definition  Definition   
Entry Ety    Etymology  
Entry Also    See also
Entry Alt    Alternative
Entry Pronunciation Pronunciation
Entry PS     Part of speech
Entry ro     Related other
Entry Spelling   Spelling
If the current item is of a certain type, the following relations will get the next item in the dictionary of the same type.

Entry abbr
Entry acr
Entry adj
Entry adv
Entry conj
Entry init
Entry interj
Entry intr
Entry intrv
Entry n
Entry NoPs   No part of speech
Entry pln
Entry prep
Entry pron
Entry tr
Entry trv
Entry UP    Unpronounceable
Entry v
Entry WD    Word
Entry $A    Morphological adjective
Entry $N    Morphological noun
Entry $An    Morphological adjective/noun
Entry $Av    Morphological adverb
Entry $V    Morphological verb
Entry $W    Morphological word
Entry $Xa    Morphologically exceptional adjective
Entry $Xan   Morphologically exceptional adjective/noun
Entry $Xav   Morphologically exceptional adverb
Entry $Xn    Morphologically exceptional noun
Entry $Xv    Morphologically exceptional verb
Entry $Xw    Morphologically exceptional word
Entry NextEntry
GetStringValue: PROC [Item: Rope.ROPE]
RETURNS
 [RetrievedText: Rope.ROPE];
GetStringValue takes a RetrievedItem, as returned by Retrieve, and gets the
associated item from the dictionary, i.e. the actual definition, etymology, etc.
May raise Empty or NoText.
Signals
DictFailure: TYPE = { ArgError, HandleError };
DictFailed: ERROR[why: DictFailure];
DictFailed is raised inside Retrieve if the item or the relation passed in are invalid.
NoText: SIGNAL RETURNS [text: Rope.ROPE];
NoText is raised if an item supplied has gone stale. The caller should resume the signal with the original text.
Empty: ERROR;
Empty is raised if a given relation is not filled for a given item.
NotFound: ERROR[word: Rope.ROPE, startPos, endpos: INT];
NotFound is raised if no dictionary entry can be found for the indicated word, lying between startPos and endPos in the current text.
MorphCorrection: SIGNAL[word: Rope.ROPE, startPos, endpos: INT];
MorphCorrection is raised in the case of a correctable error. The arguments are the suggested corrections and the position of the word in error. If the caller resumes the signal, the original call will return with the entry for the corrected item.
END.