Closed Tiepies closed 9 years ago
Thanks for the report!
I've committed a potential fix with a different sort of hack. I tested JPypeBackend
against CoreNLP versions 1.3.5, 3.3.0, 3.5.0, and 3.5.1 -- please reopen if it still doesn't work for you.
When initializing a
JPypeBackend
object, thepuncFilter
attribute is set totrees.PennTreebankLanguagePack().punctuationWordRejectFilter().accept
(line 52 in JPypeBackend.py). However, for CoreNLP versions >= 3.5.0, this results in anAttributeError: 'edu.stanford.nlp.util.Filters$NegatedFilter' object has no attribute 'accept'
.The solution is to change the line to change line 52 to
self.puncFilter = trees.PennTreebankLanguagePack().punctuationWordRejectFilter().test
. That breaks compatibility with CoreNLP versions < 3.5.0. I worked out a hacky version check usingjava.util.jar.JarInputStream(stream).getManifest()
. If you like to retain compatibility with older CoreNLP versions, I could fork and send a pull request. Otherwise it is a quick fix.