WordNetResource extends AbstractResource { @Override public int getNumberOfEntities() throws LexicalSemanticResourceException { if (this.numberOfEntities < 0) { int i=0; try { Iterator<Synset> adjIter = dict.getSynsetIterator(POS.ADJECTIVE); Iterator<Synset> advIter = dict.getSynsetIterator(POS.ADVERB); Iterator<Synset> nounIter = dict.getSynsetIterator(POS.NOUN); Iterator<Synset> verbIter = dict.getSynsetIterator(POS.VERB); while(adjIter.hasNext()) { i++; adjIter.next(); } while(advIter.hasNext()) { i++; advIter.next(); } while(nounIter.hasNext()) { i++; nounIter.next(); } while(verbIter.hasNext()) { i++; verbIter.next(); } numberOfEntities = i; } catch (JWNLException e) { throw new LexicalSemanticResourceException(e); } } return numberOfEntities; } 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 testGetNumberOfEntities() throws LexicalSemanticResourceException { assertEquals(117659, wordnet.getNumberOfEntities()); }