public double getSynsetDepth(String word, int senseno, String pos) { IIndexWord word1 = null; // get the WordNet words in *any* POS ArrayList<Integer> homehierarchies = null; // if(pos.equalsIgnoreCase("n")) // { try { word1 = dict.getIndexWord(word, POS.NOUN); homehierarchies = nounroots; System.out.println(word1.toString() + "||||"); // } // if(pos.equalsIgnoreCase("v")) // { // word1 = dict.getIndexWord(word, POS.VERB); // homehierarchies = verbroots; // } // ........................................................................................................................................... IWordID word1ID = word1.getWordIDs().get(senseno - 1); // get the right sense of word 1 ISynset synset1 = dict.getWord(word1ID).getSynset(); // ........................................................................................................................................... // get a score TreeMap<Integer, HashSet<ISynsetID>> depths = new TreeMap<Integer, HashSet<ISynsetID>>(); HashSet<ISynsetID> synsets = new HashSet<ISynsetID>(); synsets.add(synset1.getID()); treecreeper(0, synsets, depths, homehierarchies); if (depths.isEmpty()) { return (0.0); // i.e. is <root>, nothing 'above' it } return ((double) (depths.lastKey() + 2.0)); } catch (Exception ex) { } return 0.0; // ??? node counting, so have to include start and end node }