WiktionaryResource extends AbstractResource { public Set<Entity> getEntity(String lexeme) { Set<Entity> resultEntities = new HashSet<Entity>(); List<WordEntry> words = wkt.getWordEntries(lexeme); for (WordEntry word : words) { resultEntities.add( new Entity(lexeme, WiktionaryUtils.mapPos(word.getPartOfSpeech()))); } return resultEntities; } WiktionaryResource(
    		Language language,
    		String wiktionaryDirectory); @Override void setIsCaseSensitive(boolean isCaseSensitive); @Override boolean getIsCaseSensitive(); boolean containsLexeme(String lexeme); boolean containsEntity(Entity entity); Set<Entity> getEntity(String lexeme); Set<Entity> getEntity(String lexeme, PoS pos); Set<Entity> getEntity(String lexeme, PoS pos, String sense); Set<Entity> getParents(Entity entity); Set<Entity> getChildren(Entity entity); int getNumberOfEntities(); Iterable<Entity> getEntities(); @Override Set<Entity> getNeighbors(Entity entity); String getResourceName(); String getResourceVersion(); int getShortestPathLength(Entity firstEntity, Entity secondEntity); String getGloss(Entity entity); Set<Entity> getRelatedEntities(Entity entity, SemanticRelation semanticRelation); Set<String> getRelatedLexemes(String lexeme, PoS pos, String sense, LexicalRelation lexicalRelation); @Override Entity getRoot(); @Override Entity getRoot(PoS pos); @Override Entity getMostFrequentEntity(String lexeme); @Override Entity getMostFrequentEntity(String lexeme, PoS pos);  }
@Test public void testGetEntity() throws Exception { Set<String> expectedResults = new HashSet<String>(); expectedResults.add("mine#-|---n"); expectedResults.add("mine#-|---v"); expectedResults.add("mine#-|---unk"); Set<Entity> entities; wiktionaryEnglish.setIsCaseSensitive(false); entities = wiktionaryEnglish.getEntity("mine"); System.out.println(entities); assertEquals(expectedResults.size(), entities.size()); for (Entity entity : entities) { assertTrue(entity.toString(), expectedResults.contains(entity.toString())); } wiktionaryEnglish.setIsCaseSensitive(true); entities = wiktionaryEnglish.getEntity("mine"); System.out.println(entities); assertEquals(expectedResults.size(), entities.size()); for (Entity entity : entities) { assertTrue(entity.toString(), expectedResults.contains(entity.toString())); } Set<String> expectedResults2 = new HashSet<String>(); expectedResults2.add("gerade#-|---adj"); expectedResults2.add("gerade#-|---n"); expectedResults2.add("gerade#-|---adv"); expectedResults2.add("gerade#-|---unk"); wiktionaryGerman.setIsCaseSensitive(false); Set<Entity> entities2 = wiktionaryGerman.getEntity("gerade"); System.out.println("***gerade Entities: " + entities2); assertEquals(expectedResults2.size(), entities2.size()); for (Entity entity : entities2) { assertTrue(entity.toString(), expectedResults2.contains(entity.toString())); } Set<String> expectedResults3 = new HashSet<String>(); expectedResults3.add("gerade#-|---adj"); expectedResults3.add("gerade#-|---adv"); expectedResults3.add("gerade#-|---unk"); wiktionaryGerman.setIsCaseSensitive(true); entities2 = wiktionaryGerman.getEntity("gerade"); System.out.println("***gerade Entities: " + entities2); assertEquals(expectedResults3.size(), entities2.size()); for (Entity entity : entities2) { assertTrue(entity.toString(), expectedResults2.contains(entity.toString())); } }