@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JwnlSynset other = (JwnlSynset) obj; if (realSynset == null) { if (other.realSynset != null) return false; } else if (!realSynset.equals(other.realSynset)) return false; return true; }
public Object execute(PointerTargetTreeNode testNode) { if (targetSynset.equals(testNode.getPointerTarget())) { return testNode; } return null; } };
/** Two relationships are assumed equal if they have the same source synset, target synset, and type */ public boolean equals(Object obj) { if (obj instanceof Relationship) { Relationship r = (Relationship) obj; return r.getType().equals(getType()) && r.getSourceSynset().equals(getSourceSynset()) && r.getTargetSynset().equals(getTargetSynset()); } return false; }
/** Two words are equal if their parent Synsets are equal and they have the same index */ public boolean equals(Object object) { return (object instanceof Word) && ((Word) object).getSynset().equals(getSynset()) && ((Word) object).getIndex() == getIndex(); }
@Nullable public static String getReadableSynsetID(@Nullable final String synsetID) { if (synsetID == null) { return null; } final Synset synset = getSynset(synsetID); if (synset == null) { throw new IllegalArgumentException("Illegal synset ID " + synsetID); } final String lemma = synset.getWords()[0].getLemma(); final POS pos = POS.getPOSForKey(getPOS(synsetID)); try { final IndexWord word; synchronized (WordNet.class) { word = getDictionary().lookupIndexWord(pos, lemma); } final Synset[] senses = word.getSenses(); for (int i = 0; i < senses.length; ++i) { if (senses[i].equals(synset)) { return lemma + "-" + (i + 1) + pos.getKey(); } } throw new Error("Could not determine sense index for lemma " + lemma + " and synset " + synsetID); } catch (final JWNLException ex) { throw new Error(ex); } // return synset.getSenseKey(lemma); // TODO }