text analyzer (from Beginning Ruby by Peter Cooper)