Learning Directly from Grammar Compressed Text