/** * Returns the synset that is a) the target of this pointer, or b) the synset that contains the target of this pointer. * * @return the synset that is a) the target of this pointer, or b) the synset that contains the target of this pointer. * @throws JWNLException JWNLException */ public Synset getTargetSynset() throws JWNLException { if (null == getTarget()) { return null; } return getTarget().getSynset(); }
private void addSymmetricPointerToTarget(Pointer original) { if (null != original.getType().getSymmetricType()) { try { boolean found = false; for (Pointer p : original.getTargetSynset().getPointers()) { if (p.isSymmetricTo(original)) { found = true; break; } } if (!found) { Pointer symmetric = new Pointer(original.getType().getSymmetricType(), original.getTarget(), original.getSource()); original.getTargetSynset().getPointers().add(symmetric); } } catch (JWNLException e) { throw new JWNLRuntimeException(e); } } }
/** * Returns the synset that is a) the target of this pointer, or b) the synset that contains the target of this pointer. * * @return the synset that is a) the target of this pointer, or b) the synset that contains the target of this pointer. * @throws JWNLException JWNLException */ public Synset getTargetSynset() throws JWNLException { if (null == getTarget()) { return null; } return getTarget().getSynset(); }
/** * Returns of all the targets of <var>pointers</var>. * * @param pointers pointer to return targets of * @return all the targets of <var>pointers</var> * @throws JWNLException JWNLException */ private List<PointerTarget> collectTargets(List<Pointer> pointers) throws JWNLException { List<PointerTarget> targets = new ArrayList<>(pointers.size()); for (Pointer pointer : pointers) { targets.add(pointer.getTarget()); } return targets; }
/** * Returns of all the targets of <var>pointers</var>. * * @param pointers pointer to return targets of * @return all the targets of <var>pointers</var> * @throws JWNLException JWNLException */ private List<PointerTarget> collectTargets(List<Pointer> pointers) throws JWNLException { List<PointerTarget> targets = new ArrayList<>(pointers.size()); for (Pointer pointer : pointers) { targets.add(pointer.getTarget()); } return targets; }
/** * Returns whether this pointer is between two words. * * @return true if this pointer is between two words. * @throws JWNLException JWNLException */ public boolean isLexical() throws JWNLException { return (getSource() instanceof Word) && (getTarget() instanceof Word); }
/** * Returns whether this pointer is between two words. * * @return true if this pointer is between two words. * @throws JWNLException JWNLException */ public boolean isLexical() throws JWNLException { return (getSource() instanceof Word) && (getTarget() instanceof Word); }
/** * Returns whether this pointer is between two synsets. * * @return true if this pointer is between two synsets. * @throws JWNLException JWNLException */ public boolean isSemantic() throws JWNLException { return (getSource() instanceof Synset) && (getTarget() instanceof Synset); }
/** * Returns whether this pointer is between two synsets. * * @return true if this pointer is between two synsets. * @throws JWNLException JWNLException */ public boolean isSemantic() throws JWNLException { return (getSource() instanceof Synset) && (getTarget() instanceof Synset); }
/** * Returns whether <var>that</var> is symmetric to this pointer. * @param that pointer * @return true, if <var>that</var> is symmetric to this pointer. * @throws JWNLException JWNLException */ public boolean isSymmetricTo(Pointer that) throws JWNLException { return null != pointerType.getSymmetricType() && that.getType().equals(pointerType.getSymmetricType()) && that.getTarget().equals(getSource()) && that.getSource().equals(getTarget()); }
/** * Returns whether <var>that</var> is symmetric to this pointer. * @param that pointer * @return true, if <var>that</var> is symmetric to this pointer. * @throws JWNLException JWNLException */ public boolean isSymmetricTo(Pointer that) throws JWNLException { return null != pointerType.getSymmetricType() && that.getType().equals(pointerType.getSymmetricType()) && that.getTarget().equals(getSource()) && that.getSource().equals(getTarget()); }
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; }
public int getTargetIndex() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getIndex(); } else { return targetIndex.index; } } else { return target.getIndex(); } }
public int getTargetIndex() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getIndex(); } else { return targetIndex.index; } } else { return target.getIndex(); } }
public POS getTargetPOS() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getSynset().getPOS(); } else { return targetIndex.pos; } } else { return target.getSynset().getPOS(); } }
public POS getTargetPOS() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getSynset().getPOS(); } else { return targetIndex.pos; } } else { return target.getSynset().getPOS(); } }
/** * Returns the offset of the target synset. * * @return offset of the target synset * @throws JWNLException JWNLException */ public long getTargetOffset() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getSynset().getOffset(); } else { return targetIndex.offset; } } else { return target.getSynset().getOffset(); } }
/** * Returns the offset of the target synset. * * @return offset of the target synset * @throws JWNLException JWNLException */ public long getTargetOffset() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getSynset().getOffset(); } else { return targetIndex.offset; } } else { return target.getSynset().getOffset(); } }
/** * This method consumes a lexical pointer and generates the associated RelatedForm, defined in Uby-LMF * @param pointer WordNet's lexical pointer * @return RelatedForm associated with the consumed pointer * @see RelatedForm * @see Pointer */ private RelatedForm generateRelatedForm(Pointer pointer){ RelatedForm relatedForm = new RelatedForm(); // setting RelationType ERelTypeMorphology relType = getRelType(pointer.getType().getKey(), POS.getAllPOS().indexOf(pointer.getSource().getPOS())); relatedForm.setRelType(relType); // setting targetSense Word targetLexeme = (Word) pointer.getTarget(); relatedForm.setTargetSense(lexicalEntryGenerator.getSenseGenerator().getSense(targetLexeme)); // setting targeted LexicalEntry LexicalEntry targetLexicalEntry = lexicalEntryGenerator.getLexicalEntry(targetLexeme); if (targetLexicalEntry == null) throw new NullPointerException("Unable to find target lexical entry of related form for " + targetLexeme); relatedForm.setTargetLexicalEntry(targetLexicalEntry); return relatedForm; }
/** * This method creates a SenseRelation based on the consumed WordNet-pointer * @param pointer WordNet's {@link Pointer} * @return instance of {@link SenseRelation}-class associated with the consumed pointer */ private SenseRelation createSenseRelation(Pointer pointer){ SenseRelation senseRelation = new SenseRelation(); // Setting the target Word target = (Word) pointer.getTarget(); senseRelation.setTarget(lexicalEntryGenerator.getSenseGenerator().getSense(target)); String pointerKey = pointer.getType().getKey(); int posOrdinal = POS.getAllPOS().indexOf(pointer.getSource().getPOS()); // setting RelationName String relName = getRelName(pointerKey, posOrdinal); senseRelation.setRelName(relName); // settin relation type ERelTypeSemantics relType = getRelType(pointerKey, posOrdinal); senseRelation.setRelType(relType); return senseRelation; }