/** * 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); }
public String toString() { String targetMsg = (target == null) ? targetIndex.toString() : target.toString(); return ResourceBundleSet.insertParams("[PointerTarget: [Source Index: {0}] Source: {1} Target: {2}]", new Object[]{getSourceIndex(), getSource(), targetMsg}); }
/** * 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); }
public String toString() { String targetMsg = (target == null) ? targetIndex.toString() : target.toString(); return ResourceBundleSet.insertParams("[PointerTarget: [Source Index: {0}] Source: {1} Target: {2}]", new Object[]{getSourceIndex(), getSource(), targetMsg}); }
/** * 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 all the pointers of the synset that contains this word whose source is this word. */ public List<Pointer> getPointers() { List<Pointer> result = new ArrayList<>(0); for (Pointer pointer : getSynset().getPointers()) { if (this.equals(pointer.getSource())) { result.add(pointer); } } return result; }
/** * Returns all the pointers of the synset that contains this word whose source is this word. */ public List<Pointer> getPointers() { List<Pointer> result = new ArrayList<>(0); for (Pointer pointer : getSynset().getPointers()) { if (this.equals(pointer.getSource())) { result.add(pointer); } } return result; }
/** * 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()); }
@Override public String transform(Pointer p) { Synset source; PointerTarget pt = p.getSource(); if (pt instanceof Word) { source = ((Word) pt).getSynset(); } else { source = (Synset) pt; } try { return synsetToString.transform(source) + " -> " + synsetToString.transform(p.getTargetSynset()); } catch (JWNLException e) { throw new IllegalArgumentException(e); } } }
@Override public UnorderedPair<String> transform(Pointer p) { Synset source; PointerTarget pt = p.getSource(); if (pt instanceof Word) { source = ((Word) pt).getSynset(); } else { source = (Synset) pt; } try { return new UnorderedPair<String>( synsetToString.transform(source), synsetToString.transform(p.getTargetSynset())); } catch (JWNLException e) { throw new IllegalArgumentException(e); } } }
Pointer pointer = super.get(i); try { if (dictionary != pointer.getSource().getDictionary() || null == pointer.getTarget() || dictionary != pointer.getTarget().getDictionary()) { if (null == toDelete) { toDelete = new ArrayList<>();
Pointer pointer = super.get(i); try { if (dictionary != pointer.getSource().getDictionary() || null == pointer.getTarget() || dictionary != pointer.getTarget().getDictionary()) { if (null == toDelete) { toDelete = new ArrayList<>();
/** * 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; }
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); } } }
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); } } }
/** * 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; }