public void analyze(Reader input, Writer output) throws IOException {
        Analyzer analyzer = Morfeusz.getInstance().getAnalyzer();
        int words = 0;
        long start = System.currentTimeMillis();
        
        StreamTokenizer tokenizer = new StreamTokenizer(input);
        
        int token;
        while (StreamTokenizer.TT_EOF != (token = tokenizer.nextToken())) {
            if (token == StreamTokenizer.TT_WORD) {
                output.write(tokenizer.sval);
                output.write(" ");

                words++;
                InterpMorf[] analysis = 
                    analyzer.analyze(tokenizer.sval);
                if (analysis == null) {
                    output.write("?");
                } else {
                    for (int j=0; j<analyzer.getTokensNumber(); j++) {
                        String part = analysis[j].getTokenImage(); 
                        String lemma = analysis[j].getLemmaImage();
                        String tag = analysis[j].getTagImage();
                        
                        if (j>0) output.write("; ");
                        output.write(part);
                        output.write(",");
                        output.write(lemma);
                        output.write(",");
                        output.write(tag);
                        
                        if (parseTags) {
                            try {
                                Tag.create(tag);
                            } catch (RuntimeException e) {
                                System.err.println("Could not parse tag for: "
                                        + tokenizer.sval + " ('" + tag + "'); Error: "
                                        + e.toString());
                            }
                        }
                    }
                }

                output.write("\n");
            } else {
                // ignore other tokens
            }
        }
        input.close();
        output.close();
        
        long time = (System.currentTimeMillis() - start);
        System.err.println("Analyzed: " + words + " words in " +
                time + " milliseconds." );
        System.err.println( (int)(words / (time / 1000.0f)) + " words per second.");
    }