Как удалить данные из PointerTargetNodeList?
Я хочу удалить все лишние детали, обратите внимание, что тип возвращаемого значения - PointerTargetNodeList, а не String.
Это вывод кода:
Direct hypernyms of "apple":
[PointerTargetNode: [Synset: [Offset: 7721676] [POS: noun] Words: edible_fruit -- (edible reproductive body of a seed plant especially one having sweet flesh)] null]
[PointerTargetNode: [Synset: [Offset: 13159619] [POS: noun] Words: pome, false_fruit -- (a fleshy fruit (apple or pear or related fruits) having seed chambers and an outer fleshy part)] null]
Direct hypernyms of "banana":
[PointerTargetNode: [Synset: [Offset: 12226211] [POS: noun] Words: herb, herbaceous_plant -- (a plant lacking a permanent woody stem; many are flowering garden plants or potherbs; some having medicinal properties; some are pests)] null]
Direct hypernyms of "mango":
[PointerTargetNode: [Synset: [Offset: 12672582] [POS: noun] Words: fruit_tree -- (tree bearing edible fruit)] null]
И требуемый вывод:
May 03, 2018 8:30:08 PM net.didion.jwnl.util.MessageLog doLog
INFO: Installing dictionary net.didion.jwnl.dictionary.FileBackedDictionary@506e1b77
Direct hypernyms of "apple":edible_fruit pome,
false_fruit
Direct hypernyms of "banana": herb, herbaceous_plant
Direct hypernyms of "mango": fruit_tree
И код выглядит следующим образом:
private static PointerTargetNodeList demonstrateListOperation(IndexWord word) throws JWNLException {
try {
PointerTargetNodeList hypernyms = PointerUtils.getInstance().getDirectHypernyms(word.getSense(1));
System.out.println("Direct hypernyms of \"" + word.getLemma() + "\":");
return hypernyms;
} catch(Exception exx){
exx.printStackTrace();
System.exit(-1);
}
return null;
}