Why definer a local variable `pairs`?:

I would rather have:

```python
for i, token in enumerate(vocabulary):
    if vocabulary.setdefault(token, i) != i:
        msg = "Duplicate term in vocabulary: %r" % token
        raise ValueError(msg)
```