text.hpp: unify the text_reader and word_stream APIs