GermaNetResource extends AbstractResource { public Set<Entity> getEntity(String lexeme) throws LexicalSemanticResourceException { Entity e = new Entity(lexeme); Set<Entity> entities = GermaNetUtils.synsetsToEntities( GermaNetUtils.entityToSynsets(gn, e) ); return entities; } GermaNetResource(String path, boolean ignoreCase);  GermaNetResource(String path); boolean containsEntity(Entity entity); boolean containsLexeme(String lexeme); Set<Entity> getEntity(String lexeme); Set<Entity> getEntity(String lexeme, PoS pos); Set<Entity> getEntity(String lexeme, PoS pos, String sense); Set<Entity> getChildren(Entity entity); Iterable<Entity> getEntities(); int getNumberOfEntities(); Set<Entity> getParents(Entity entity); String getResourceName(); String getResourceVersion(); int getShortestPathLength(Entity firstEntity, Entity secondEntity); String getGloss(Entity entity); Set<String> getRelatedLexemes(String lexeme, PoS pos, String sense, LexicalRelation lexicalRelation); Set<Entity> getRelatedEntities(Entity entity, SemanticRelation semanticRelation); @Override Entity getRoot(); @Override Entity getRoot(PoS pos); @Override Entity getMostFrequentEntity(String lexeme); @Override Entity getMostFrequentEntity(String lexeme, PoS pos);  }
@Test @Ignore("This test produces too much console output and runs too slow. Deactivated for now.") public void testHyponymMap() throws Exception { EntityGraph eg = EntityGraphManager.getEntityGraph(germaNetCaseInsensitive, EntityGraphType.JGraphT); eg.getIntrinsicInformationContent(germaNet.getEntity("kalt").iterator().next()); }
@Test public void testGetEntity() throws LexicalSemanticResourceException { Set<String> expectedResults = new HashSet<String>(); expectedResults.add("Absatz#1|Abschnitt#1|Textabschnitt#1|---n"); expectedResults.add("Absatz#4|Schuhabsatz#1|---n"); expectedResults.add("Ablagerung#1|Absatz#3|---n"); expectedResults.add("Absatz#2|---n"); expectedResults.add("Absatz#6|Verkauf#1|Vertrieb#3|---n"); expectedResults.add("Absatz#5|Schwelle#2|T\u00fcrabsatz#1|T\u00fcrschwelle#1|---n"); Set<Entity> entities = germaNetCaseInsensitive.getEntity("Absatz"); assertEquals(6, entities.size()); for (Entity entity : entities) { assertTrue(entity.getId(), expectedResults.contains(entity.getId())); } entities = germaNet.getEntity("absatz"); assertEquals(0, entities.size()); }
@Test public void testGetEntityPos() throws LexicalSemanticResourceException { Set<String> expectedResults = new HashSet<String>(); expectedResults.add("Absatz#1|Abschnitt#1|Textabschnitt#1|---n"); expectedResults.add("Absatz#4|Schuhabsatz#1|---n"); expectedResults.add("Ablagerung#1|Absatz#3|---n"); expectedResults.add("Absatz#2|---n"); expectedResults.add("Absatz#6|Verkauf#1|Vertrieb#3|---n"); expectedResults.add("Absatz#5|Schwelle#2|T\u00fcrabsatz#1|T\u00fcrschwelle#1|---n"); Set<Entity> entities = germaNetCaseInsensitive.getEntity("Absatz", PoS.n); assertEquals(6, entities.size()); for (Entity entity : entities) { assertTrue(entity.getId(), expectedResults.contains(entity.getId())); } entities = germaNet.getEntity("absatz", PoS.n); assertEquals(0, entities.size()); }
@Test public void testGetEntityPosSense() throws LexicalSemanticResourceException { Set<String> expectedResults = new HashSet<String>(); expectedResults.add("Auto#1|Automobil#1|Kraftfahrzeug#1|Kraftwagen#1|Motorfahrzeug#1|Motorwagen#2|Wagen#3|---n"); Map<String,String> autoLexemes = new HashMap<String,String>(); autoLexemes.put("Kraftfahrzeug", "1"); autoLexemes.put("Kraftwagen", "1"); autoLexemes.put("Auto", "1"); autoLexemes.put("Wagen", "3"); autoLexemes.put("Motorwagen", "2"); autoLexemes.put("Motorfahrzeug", "1"); autoLexemes.put("Automobil", "1"); Entity autoEntity = new Entity(autoLexemes, PoS.n); Set<Entity> entities = germaNetCaseInsensitive.getEntity("Auto", PoS.n, "1"); assertEquals(1, entities.size()); for (Entity entity : entities) { assertTrue(entity.getId(), expectedResults.contains(entity.getId())); assertEquals(0, entity.compareTo(autoEntity)); } entities = germaNet.getEntity("auto", PoS.n, "1"); assertEquals(0, entities.size()); }
@Test public void testOelCase() throws LexicalSemanticResourceException { String oel = "\u00d6l"; Set<Entity> entities = germaNet.getEntity(oel); for (Entity e : entities) { System.out.println(e); System.out.println(e.getSense(oel)); assertTrue(e.getSense(oel) != null); } }