nltk/nltk — pull request #290 by pflaquerre (2012-09-05 19:03:32+00:00)
Title: Make MaltParser safe to use in parallel

These commits make MaltParser safe(r) to use in parallel. The paths to temporary files used to be hard-coded, which would be problematic if you're running multiple instances at the same time. There is still a potential issue if the user leaves mco to the default value, but I wasn't sure whether the user would expect the model to still be there after nltk quits or not in this case.

Changes:
- Actually use self.working_dir
- Replace hard-coded temporary file names with tempfile.NamedTemporaryFile
- Use subprocess instead of os.system to avoid quoting issues when calling java
- Error out if subprocess fails instead of blindly going forward