Squeak
  QotD    "To be or not to be" – Shakespeare
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
WordNet
Last updated at 9:41 pm UTC on 13 April 2019
WordNet is a lexical database for the English language [1].
There is a class WordNet in the image of Squeak 5.2 to query this database.
 Object subclass: #WordNet
 	instanceVariableNames: 'form url args word replyHTML parts partStreams rwStream replyParsed'
 	classVariableNames: 'CanTranslateFrom Languages'
 	poolDictionaries: ''
 	category: 'Etoys-Squeakland-Network-TelNet WordNet'

It is to check if this still works in Squeak 5.2. The class gives access to WordNet entries through web queries.

A different solution which works fine is it to load the WordNet objects into the image, see the project SmalltalkWordNet for loading the Prolog database serialization.

Class comment of class WordNet

Query the WordNet lexicon at Princeton Univ. At http://www.cogsci.princeton.edu/cgi-bin/webwn/
To get the definition of a word, select any word in any text pane, and choose "definition of word" from the shift menu.
WordNet is also used for the "verify spelling of word" menu item.

Subclasses are interfaces to other dictionaries.

The "choose language" item on the shift-menu lets you select a language (and its server). (Preferences setPreference: #myLanguage toValue: #Portuguese).

 WordNet openScamperOn: 'balloon'.


 DD _ WordNet new.
 DD definition: 'balloon'.
 DD parts "of speech".
 	 OrderedCollection ('noun' 'verb' )
 DD sensesFor: 'noun'.
	 2
 DD def: 1 for: 'noun'.
 	 '(large tough non-rigid bag filled with gas or hot air)'
After the initial response, keep a separate stream for the definition of each part of speech. Caller may later query them for information.