WordNet class: // constructor takes the name of the two input files public WordNet(String synsets, String hypernyms) // a synset (second field of synsets.txt) that is the common ancestor of nounA and nounB // in a shortest ancestral path public String sap(String nounA, String nounB) // distance between nounA and nounB (the distance to the common ancestor) public int distance(String nounA, String nounB) SAP class: // constructor takes a digraph (not necessarily a DAG) public SAP(Digraph G) // length of shortest ancestral path between v and w; -1 if no such path public int length(int v, int w) // a common ancestor of v and w that participates in a shortest ancestral path; -1 if no such path public int ancestor(int v, int w) // length of shortest ancestral path between any vertex in v and any vertex in w; -1 if no such path public int length(Iterable v, Iterable w) // a common ancestor that participates in shortest ancestral path; -1 if no such path public int ancestor(Iterable v, Iterable w) Outcast class: // constructor takes a WordNet object public Outcast(WordNet wordnet) // given an array of WordNet nouns, return an outcast public String outcast(String[] nouns) ============================================================================= Example input file (smallsynsets.txt): 3003,cage coop,an enclosure made or wire or metal bars in which birds or animals can be kept 3004,cage,something that restricts freedom as a cage restricts movement 14953,pound dog_pound,a public enclosure for stray or unlicensed dogs 23560,artifact artefact,a man-made object taken as a whole 29959,catchall,an enclosure or receptacle for odds and ends 39789,enclosure,artifact consisting of a space that has been enclosed for some purpose 33574,constraint restraint,the state of being physically constrained Example input file (smallhypernyms.txt) 3003,39789 3004,33574 14953,39789 29959,39789,65893 39789,23560