WiktionaryResource extends AbstractResource { public boolean containsEntity(Entity entity) { Set<WordEntry> entries = WiktionaryUtils.entityToWords(wkt, entity); if (entries.size() == 0) { return false; } else { return true; } } 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 testContainsEntity() throws Exception { wiktionaryGerman.setIsCaseSensitive(true); assertTrue("Auto", wiktionaryGerman.containsEntity(new Entity("Baum", Entity.PoS.n))); assertTrue("Auto", wiktionaryGerman.containsEntity(new Entity("Auto", Entity.PoS.n))); assertFalse("auto", wiktionaryGerman.containsEntity(new Entity("auto", Entity.PoS.n))); assertFalse("car", wiktionaryGerman.containsEntity(new Entity("car", Entity.PoS.n))); assertFalse("humbelpfh", wiktionaryGerman.containsEntity(new Entity("humbelpfh", Entity.PoS.n))); wiktionaryGerman.setIsCaseSensitive(false); assertTrue("Auto", wiktionaryGerman.containsEntity(new Entity("Auto", Entity.PoS.n))); assertTrue("auto", wiktionaryGerman.containsEntity(new Entity("auto", Entity.PoS.n))); assertFalse("car", wiktionaryGerman.containsEntity(new Entity("car", Entity.PoS.n))); assertFalse("humbelpfh", wiktionaryGerman.containsEntity(new Entity("humbelpfh", Entity.PoS.n))); wiktionaryEnglish.setIsCaseSensitive(true); assertTrue("car", wiktionaryEnglish.containsEntity(new Entity("car", Entity.PoS.n))); assertFalse("Car", wiktionaryEnglish.containsEntity(new Entity("CaR", Entity.PoS.n))); assertFalse("humbelpfh", wiktionaryEnglish.containsEntity(new Entity("humbelpfh", Entity.PoS.n))); wiktionaryEnglish.setIsCaseSensitive(false); assertTrue("car", wiktionaryEnglish.containsEntity(new Entity("car", Entity.PoS.n))); assertTrue("car", wiktionaryEnglish.containsEntity(new Entity("Car", Entity.PoS.n))); assertFalse("humbelpfh", wiktionaryEnglish.containsEntity(new Entity("humbelpfh", Entity.PoS.n))); }