private List<String> parseOutput(String stemOutput) {
        List<String> words = new ArrayList<>();
        StringBuffer buffer = new StringBuffer();

        for (int i = 0; i < stemOutput.length(); ++i) {
            char symbol = stemOutput.charAt(i);
            if (symbol == '?') {
                buffer.delete(0, buffer.length());
            }
            else if (symbol == '}' && buffer.length() != 0) {
                words.add(buffer.toString());
                buffer.delete(0, buffer.length());
            }
            else if (symbol != '{' && symbol != '}') {
                buffer.append(symbol);
            }
        }
        return words;
    }