return new IndexWord(lemma, pos, tagSenseCnt, words); } catch (Exception e) { throw new MisformattedLineException(line, e);
/** * Creates a new index word that replicates the specified index word. * The new index word replaces it's internal synset ids with synset ids * from the denoted synsets, thus removing redundant ids. * * @param old * the index word to be replicated * @return the new index word object * @throws NullPointerException * if the specified index word is <code>null</code> * @since JWI 2.2.0 */ protected IIndexWord makeIndexWord(IIndexWord old){ List<IWordID> oldIDs = old.getWordIDs(); IWordID[] newIDs = new IWordID[oldIDs.size()]; IWordID oldID; ISynset synset; for(int i = 0; i < oldIDs.size(); i++){ oldID = oldIDs.get(i); synset = synsets.get(oldID.getPOS()).get(oldID.getSynsetID()); for(IWord newWord : synset.getWords()){ if(!newWord.getID().equals(oldID)) continue; newIDs[i] = newWord.getID(); break; } if(newIDs[i] == null) throw new IllegalStateException(); } return new IndexWord(old.getID(), old.getTagSenseCount(), newIDs); }