A digital thesaurus contains many words and links. There are three types of words: nouns, verbs, and adjectives. Word properties include the spelling of the word and a brief description of its meaning. A link is a relationship between two words. There are four types of links: synonyms, homonyms, and weak synonyms. There are two types of weak synonyms: hyponyms, and hypernyms. A synonym links two words that mean the same thing. A homonym links two words that sound the same or that are spelled the same, but that have different meanings. A weak synonym links a word with a more general meaning (called a hypernym) to a word with more special meaningn (called a hyponym). For example, a thesaurus might contain a weak synonym connecting the word "ship" (the hypernym) to the word "schooner" (the hyponym).
A digital thesaurus provides operations for adding words and links. It also provides operations for finding the synonyms and weak synonyms of all homonyms of a give word.
(i) Using a CASE tool, draw a UML class diagram modeling the thesaurus concepts described above.
(ii) Roger's Thesaurus (a poor cousin of Roget's Thesaurus) contains the following words:
ant, bug, fault, crack, insect, drug
Using your class diagram as a guide, use a CASE tool to draw a UML object diagram representing Roger's Thesaurus.
(iii) Translate your class diagram from part (i) into Java class declarations. Include a main() method in your Thesaurus class. As a test, this method constructs Roger's Thesaurus as described in part (ii). After the thesaurus is constructed, display the result of searching for the hypernyms, hyponyms, homonyms, and synonyms of "bug".
Submit hard copy of your diagrams, your source code, and the output of main.
Hints:
Hint 1: I have replaced the Hyponym and Hypernym classes with the class WeakSynonym (for lack of a better name). A WeakSynonym object connects a hypernym to a hyponym.
Hint 2: It might not be a bad idea for a word to store the weak synonym links for which it is a hyponym in a separate set from the weak synonym links for which it is a hypernym:
class Word {
Set synonyms, homonyms, hypernyms,
hyponyms;
// etc.
}
If you follow this advice be sure to reflect it in your class diagram.
Hint 3: Synonymy is a symmetric relation. Therefore, you may assume that if for example "sedan" is a hyponym of "car" and "automobile" is a synonym of "car", then "sedan" is automatically hyponym of "automobile". In other words, you don't need to create two WeakSynonym objects, one linking "car" to "sedan" and another linking "automobile" to "sedan". Of course when we ask for the hyponyms of "automobile", the thesaurus will list "sedan".