WordNetResource extends AbstractResource { @Override public boolean containsLexeme(String lexeme) throws LexicalSemanticResourceException { if (lexeme == null) { return false; } try { IndexWord[] indexWords = dict.lookupAllIndexWords(lexeme).getIndexWordArray(); for (IndexWord item : indexWords){ if(isCaseSensitive){ if(item.getLemma().equals(lexeme)) { return true; } }else{ if(item.getLemma().equalsIgnoreCase(lexeme)) { return true; } } } } catch (JWNLException e) { throw new LexicalSemanticResourceException(e); } return false; } WordNetResource();  WordNetResource(String wordNetPropertiesFile); @Override boolean containsLexeme(String lexeme); @Override boolean containsEntity(Entity entity); @Override Set<Entity> getEntity(String lexeme); @Override Set<Entity> getEntity(String lexeme, PoS pos); @Override Set<Entity> getEntity(String lexeme, PoS pos, String sense); Set<Entity> getEntity(String lexeme, PoS pos, int sense); @Override Set<Entity> getParents(Entity entity); @Override int getNumberOfEntities(); @Override Iterable<Entity> getEntities(); @Override Set<Entity> getChildren(Entity entity); @Override String getResourceName(); @Override String getResourceVersion(); @Override int getShortestPathLength(Entity firstEntity, Entity secondEntity); @Override String getGloss(Entity entity); @Override Set<String> getRelatedLexemes(String lexeme, PoS pos, String sense, LexicalRelation lexicalRelation); @Override Set<Entity> getRelatedEntities(Entity entity, SemanticRelation semanticRelation); Set<Entity> getRelatedEntitiesByName(Entity entity, String semanticRelation); @Override Entity getRoot(); @Override Entity getRoot(PoS pos); @Override Entity getMostFrequentEntity(String lexeme); @Override Entity getMostFrequentEntity(String lexeme, PoS pos); Dictionary getDict();  }
@Test public void testContainsLexeme() throws Exception { wordnet.setIsCaseSensitive(false); assertTrue(wordnet.containsLexeme("tree")); assertTrue(wordnet.containsLexeme("Tree")); assertTrue(wordnet.containsLexeme("cold")); assertTrue(wordnet.containsLexeme("Cold")); assertFalse(wordnet.containsLexeme("grhphafah")); assertFalse(wordnet.containsLexeme("Grhphafah")); wordnet.setIsCaseSensitive(true); assertTrue(wordnet.containsLexeme("tree")); assertFalse(wordnet.containsLexeme("Tree")); assertTrue(wordnet.containsLexeme("cold")); assertFalse(wordnet.containsLexeme("ColD")); assertFalse(wordnet.containsLexeme("grhphafah")); assertFalse(wordnet.containsLexeme("Grhphafah")); }