Corpus implementation in Ruby