private static ArrayList<String> getWordsFromComposite(Composite composite) {
        ArrayList<String> allWords = new ArrayList<>();
        Iterator<Component> itBook = composite.iterator();
        while (itBook.hasNext()) {
            // абзацы + код
            Component compBook = itBook.next();
            if (compBook.getClass() == Composite.class) {
                Iterator<Component> itPar = ((Composite) compBook).iterator();
                while (itPar.hasNext()) {
                    //предложения
                    Component compSentence = itPar.next();
                    if (compSentence.getClass() == Composite.class) {
                        Iterator<Component> itSent = ((Composite) compSentence).iterator();
                        while (itSent.hasNext()) {
                            //лексемы
                            Component compLexeme = itSent.next();
                            if ((compLexeme.getClass() == Lexeme.class) && (((Lexeme) compLexeme).getType() == LexemeType.WORD)) {
                                allWords.add(((Lexeme) compLexeme).getTextOfComponent());
                            }
                        }
                    }
                }
            }
        }
        return allWords;
    }