public Set<SensedWord> getNeighborSensedWords(WordNetRelation relation) throws WordNetException { Set<SensedWord> sensedWords = new LinkedHashSet<SensedWord>(); if (relation.isLexical()) { List<Pointer> pointers = wordObj.getPointers(ExtJwnlUtils.wordNetRelationToPointerType(relation)); for (Pointer pointer : pointers) // add a new SensedWord made of the Word-cast of this pointer sensedWords.add( new ExtJwnlSensedWord(((Word) pointer.getTarget()), dictionary)); } return sensedWords; }
/** * This method updates RelatedForms of all LexicalEntries provided by the {@link LexicalEntryGenerator} * @see LexicalEntry * @see RelatedForm */ void updateRelatedForms() { Map<Set<Word>, LexicalEntry> mappings = lexicalEntryGenerator.getLexemeGroupLexicalEntryMaping(); // Iterate over all lexemeGroups and update the RelatedForms of corresponding LexicalEntries for(Set<Word> lexemeGroup : mappings.keySet()){ Set<RelatedForm> relatedForms = new LinkedHashSet<RelatedForm>(); // Iterate over every Lexeme and check for possible RelatedForms for(Word lexeme : lexemeGroup) { for(Pointer pointer : lexeme.getPointers()) { if(pointerTypeRelTypeMappings.containsKey(pointer.getType().getKey())){ relatedForms.add(generateRelatedForm(pointer)); } } } mappings.get(lexemeGroup).setRelatedForms(new ArrayList<RelatedForm>(relatedForms)); } }
/** * This method updates SenseRelations of the Sense associated with the consumed lexeme. * @see Sense * @see SenseRelation * @see Word */ private void updateSenseRelations(Word lexeme) { SenseGenerator senseGenerator = lexicalEntryGenerator.getSenseGenerator(); Sense sense = senseGenerator.getSense(lexeme); List<SenseRelation> senseRelations = new LinkedList<SenseRelation>(); for(Pointer pointer : lexeme.getPointers()){ if(pointerTypeRelNameMappings.containsKey(pointer.getType().getKey())) { senseRelations.add(createSenseRelation(pointer)); } } sense.setSenseRelations(senseRelations); }
for (Pointer p : word.getPointers()) { PointerTarget t = p.getTarget(); if (t instanceof Word) {
for (Pointer p : w.getPointers()) { PointerTarget t = p.getTarget(); if (t instanceof Word) {