// distance between nounA and nounB (defined below) public int distance(String nounA, String nounB) { ifNullThrowException(nounA); ifNullThrowException(nounB); ifNounNotInThrowException(nounA); ifNounNotInThrowException(nounB); return sap.length(st.get(nounA), st.get(nounB)); }
// a synset (second field of synsets.txt) // that is the common ancestor of nounA and nounB // in a shortest ancestral path (defined below) public String sap(String nounA, String nounB) { ifNullThrowException(nounA); ifNullThrowException(nounB); ifNounNotInThrowException(nounA); ifNounNotInThrowException(nounB); int No = sap.ancestor(st.get(nounA), st.get(nounB)); return keys[No]; }