The example would be simpler if the text feature extraction was left to the `HashingVectorizer` class:

```python:
raw_doc_text = doc['title'] + '\n\n' + doc['body']
chunk.append((raw_doc_text, classid))
```
and let's get rid of the `tokens` and `token_freqs` functions.