/* vim: set expandtab tabstop=4 shiftwidth=4 : */ public class WordNet { // data type space linear in the input size // constructor takes the name of the two input files public WordNet(String synsets, String hypernyms) { // time linearithmic in the input size // throw a java.lang.IllegalArgumentException // if the input does not correspond to a rooted DAG } // the set of nouns (no duplicates), returned as an Iterable public Iterable nouns() { return null; } // is the word a WordNet noun? public boolean isNoun(String word) { // run in time logarithmic in the number of nouns return false; } // distance between nounA and nounB (defined below) public int distance(String nounA, String nounB) { // run in time linear in the size of the WordNet digraph // throw java.lang.IllegalArgumentException // unless both of the noun arguments are WordNet nouns return 0; } // a synset that is the common ancestor of nounA and nounB // in a shortest ancestral path public String sap(String nounA, String nounB) { // run in time linear in the size of the WordNet digraph // throw java.lang.IllegalArgumentException // unless both of the noun arguments are WordNet nouns return ""; } // for unit testing of this class public static void main(String[] args) { } }