Исключение нулевого указателя Wordnet для гиперного

Получение исключения нулевого указателя для гиперного в wordnet при запуске кода в Linux, но оно отлично работает в windows `JWNL.initialize(new FileInputStream(destination));

        Dictionary wordnet = Dictionary.getInstance();

        String testWord = word;
        POS pos = POS.NOUN;

        IndexWord token = wordnet.lookupIndexWord(pos, testWord); //word is a string
        Synset[] senses = token.getSenses();



        for (int i = 0; i < senses.length; i++) {

            //Getting exception in this line
            List<List<PointerTargetNode>> trees1 = PointerUtils.getInstance().getHypernymTree(senses[i],1).toList();

            for (List<PointerTargetNode> t1 : trees1)
            {

                if(t1.get(0).getSynset().getKey().toString().equals(wordnetId)) {
                    String wordId = "";
                    String wordLemma = "";
                    String wordDefinition = "";
                    for (PointerTargetNode node : t1)
                    {
                        wordId += node.getSynset().getKey().toString() + "-->";
                        wordLemma += node.getSynset().getWord(0).getLemma() + "-->";
                        wordDefinition += node.getSynset().getGloss() + "-->";
                    }

                    wordPath.add(wordLemma.trim()+"toSplitPath"+wordId.trim()+"toSplitPath"+wordDefinition.trim());

                }

            }

        }`

0 ответов

Другие вопросы по тегам