SharedWordNetResource extends BaleenResource { public Optional<String> getBestSuperSense(POS pos, String word) { final Optional<IndexWord> indexWord = lookupWord(pos, word); if (!indexWord.isPresent()) { return Optional.empty(); } else { final List<Synset> senses = indexWord.get().getSenses(); if (senses.isEmpty()) { return Optional.empty(); } else { return Optional.of(stripPOSFromSupersense(senses.get(0).getLexFileName())); } } }  Dictionary getDictionary(); Optional<IndexWord> lookupWord(final POS pos, final String word); Optional<IndexWord> getWord(final POS pos, final String lemma); Stream<String> getSuperSenses(POS pos, String word); Optional<String> getBestSuperSense(POS pos, String word);  }
@Test public void testBestSuperSense() throws JWNLException { final Optional<String> word = wnr.getBestSuperSense(POS.VERB, "know"); Assert.assertEquals("cognition", word.get()); }