Added function for converting a stream into a corpus