nltk/nltk — pull request #360 by alexrudnick (2013-02-28 05:38:57+00:00)
Title: Fix interface to the Stanford tagger so it works on Python 2 and 3

Previously, we would fail with file encoding issues on Python 3.

But now this little program works right for both, assuming you unzipped the Stanford Tagger into the same place that I did.

```python
from __future__ import print_function
from nltk.tag.stanford import POSTagger

def get_tagger(enc=None):
taggerhome = '/home/alex/software/stanford-postagger-2012-11-11'
tagger = taggerhome + '/models/wsj-0-18-bidirectional-distsim.tagger'
jar = taggerhome + '/stanford-postagger.jar'
if enc:
stanford_tagger = POSTagger(tagger, jar, encoding=enc)
else:
stanford_tagger = POSTagger(tagger, jar)
return stanford_tagger

print("DEFAULT")
tagger = get_tagger()
print(tagger.tag("The man saw the dog with the telescope .".split()))
print("*" * 80)
print("UNICODE")
tagger = get_tagger(enc='utf-8')
print(tagger.tag("The man saw the dog with the telescope .".split()))
```