/** * Adds index word to the dictionary. * * @param indexWord index word to add * @throws JWNLException JWNLException */ public void addIndexWord(IndexWord indexWord) throws JWNLException { checkEditable(); indexWord.setDictionary(this); }
/** * Adds index word to the dictionary. * * @param indexWord index word to add * @throws JWNLException JWNLException */ public void addIndexWord(IndexWord indexWord) throws JWNLException { checkEditable(); indexWord.setDictionary(this); }
/** * Removes <var>indexWord</var> from the dictionary. * * @param indexWord index word to remove * @throws JWNLException JWNLException */ public synchronized void removeIndexWord(IndexWord indexWord) throws JWNLException { checkEditable(); indexWord.setDictionary(null); // take care of words in synsets List<Synset> copy = new ArrayList<>(indexWord.getSenses()); for (Synset synset : copy) { List<Word> wordsCopy = new ArrayList<>(synset.getWords()); for (Word word : wordsCopy) { if (word.getLemma().equalsIgnoreCase(indexWord.getLemma())) { synset.getWords().remove(word); break; } } } }
/** * Removes <var>indexWord</var> from the dictionary. * * @param indexWord index word to remove * @throws JWNLException JWNLException */ public synchronized void removeIndexWord(IndexWord indexWord) throws JWNLException { checkEditable(); indexWord.setDictionary(null); // take care of words in synsets List<Synset> copy = new ArrayList<>(indexWord.getSenses()); for (Synset synset : copy) { List<Word> wordsCopy = new ArrayList<>(synset.getWords()); for (Word word : wordsCopy) { if (word.getLemma().equalsIgnoreCase(indexWord.getLemma())) { synset.getWords().remove(word); break; } } } }