public void wordsInInterrogativeSentencesWithCurrentLength(int length,
                                                               String resultFilePath)
            throws IOException{
        if(text == null) return;

        HashSet<Word> result = new HashSet<>();
        for(int i = 0; i < text.numberOfParagraphs(); i++){
            Paragraph currParagraph = text.getParagraph(i);
            for(int j = 0; j < currParagraph.numberOfSentences(); j++){
                if(currParagraph.getSentence(j).isInterrogative()){
                    Sentence currSentence = currParagraph.getSentence(j);
                    for(int k = 0; k < currSentence.numberOfSentenceElements(); k++){
                        SentenceElement currSentenceElement = currSentence.getSentenceElement(k);
                        if(currSentenceElement instanceof Word &&
                                ((Word)currSentenceElement).getNumberOfLetters() == length){
                            result.add((Word)currSentenceElement);
                        }
                    }
                }
            }
        }
        out = new BufferedWriter(new FileWriter(resultFilePath));
        for(Word word : result){
            writeSentenceElement(word);
        }
        out.flush();
    }