public Iterator<IndexWord> getIndexWordIterator(POS pos, String substring) { substring = prepareQueryString(substring); final Iterator<IndexWord> itr = getIndexWordIterator(pos); IndexWord start = null; while (itr.hasNext()) { IndexWord word = itr.next(); if (word.getLemma().contains(substring)) { start = word; break; } } return new AbstractCachingDictionary.IndexWordIterator(itr, substring, start); }
public int hashCode() { return getLemma().hashCode() ^ getPOS().hashCode(); }
public Iterator<IndexWord> getIndexWordIterator(POS pos, String substring) { substring = prepareQueryString(substring); final Iterator<IndexWord> itr = getIndexWordIterator(pos); IndexWord start = null; while (itr.hasNext()) { IndexWord word = itr.next(); if (word.getLemma().contains(substring)) { start = word; break; } } return new AbstractCachingDictionary.IndexWordIterator(itr, substring, start); }
public int hashCode() { return getLemma().hashCode() ^ getPOS().hashCode(); }
@Override public Iterator<IndexWord> getIndexWordIterator(POS pos, String substring) throws JWNLException { substring = prepareQueryString(substring); final Iterator<IndexWord> itr = getIndexWordIterator(pos); IndexWord start = null; while (itr.hasNext()) { IndexWord word = itr.next(); if (word.getLemma().contains(substring)) { start = word; break; } } return new IndexWordIterator(itr, substring, start); }
private void demonstrateListOperation(IndexWord word) throws JWNLException { // Get all of the hypernyms (parents) of the first sense of <var>word</var> PointerTargetNodeList hypernyms = PointerUtils.getDirectHypernyms(word.getSenses().get(0)); System.out.println("Direct hypernyms of \"" + word.getLemma() + "\":"); hypernyms.print(); }
private void demonstrateTreeOperation(IndexWord word) throws JWNLException { // Get all the hyponyms (children) of the first sense of <var>word</var> PointerTargetTree hyponyms = PointerUtils.getHyponymTree(word.getSenses().get(0)); System.out.println("Hyponyms of \"" + word.getLemma() + "\":"); hyponyms.print(); }
private void demonstrateTreeOperation(IndexWord word) throws JWNLException { // Get all the hyponyms (children) of the first sense of <var>word</var> PointerTargetTree hyponyms = PointerUtils.getHyponymTree(word.getSenses().get(0)); System.out.println("Hyponyms of \"" + word.getLemma() + "\":"); hyponyms.print(); }
@Override public Iterator<IndexWord> getIndexWordIterator(POS pos, String substring) throws JWNLException { substring = prepareQueryString(substring); final Iterator<IndexWord> itr = getIndexWordIterator(pos); IndexWord start = null; while (itr.hasNext()) { IndexWord word = itr.next(); if (word.getLemma().contains(substring)) { start = word; break; } } return new IndexWordIterator(itr, substring, start); }
private void demonstrateListOperation(IndexWord word) throws JWNLException { // Get all of the hypernyms (parents) of the first sense of <var>word</var> PointerTargetNodeList hypernyms = PointerUtils.getDirectHypernyms(word.getSenses().get(0)); System.out.println("Direct hypernyms of \"" + word.getLemma() + "\":"); hypernyms.print(); }
private void demonstrateSymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException { // find all synonyms that <var>start</var> and <var>end</var> have in common RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.SIMILAR_TO); System.out.println("Synonym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":"); for (Object aList : list) { ((Relationship) aList).getNodeList().print(); } System.out.println("Depth: " + list.get(0).getDepth()); } }
public String toString() { return ResourceBundleSet.insertParams("[IndexWord: [Lemma: {0}] {1}]", new Object[]{getLemma(), getPOS()}); }
private void demonstrateSymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException { // find all synonyms that <var>start</var> and <var>end</var> have in common RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.SIMILAR_TO); System.out.println("Synonym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":"); for (Object aList : list) { ((Relationship) aList).getNodeList().print(); } System.out.println("Depth: " + list.get(0).getDepth()); } }
public String toString() { return ResourceBundleSet.insertParams("[IndexWord: [Lemma: {0}] {1}]", new Object[]{getLemma(), getPOS()}); }
private void demonstrateAsymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException { // Try to find a relationship between the first sense of <var>start</var> and the first sense of <var>end</var> RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.HYPERNYM); System.out.println("Hypernym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":"); for (Object aList : list) { ((Relationship) aList).getNodeList().print(); } System.out.println("Common Parent Index: " + ((AsymmetricRelationship) list.get(0)).getCommonParentIndex()); System.out.println("Depth: " + list.get(0).getDepth()); }
private void demonstrateAsymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException { // Try to find a relationship between the first sense of <var>start</var> and the first sense of <var>end</var> RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.HYPERNYM); System.out.println("Hypernym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":"); for (Object aList : list) { ((Relationship) aList).getNodeList().print(); } System.out.println("Common Parent Index: " + ((AsymmetricRelationship) list.get(0)).getCommonParentIndex()); System.out.println("Depth: " + list.get(0).getDepth()); }
@Test public void testLookupWord() throws JWNLException { final IndexWord word = wnr.lookupWord(POS.VERB, "employing").get(); Assert.assertEquals("employ", word.getLemma()); }
@Test public void testGetWord() throws JWNLException { final Optional<IndexWord> missing = wnr.getWord(POS.VERB, "employs"); Assert.assertFalse(missing.isPresent()); final IndexWord employ = wnr.getWord(POS.VERB, "employ").get(); Assert.assertNotNull(employ); Assert.assertEquals("employ", employ.getLemma()); }