You can use the CountVectorizer in scikit-learn to encode text to a sparse array that a machine learning model can use. This functionality is great, but it can result in huge widths. An alternative to this is the HashingVectorizer which is much more light weight.
