Lynten / stanford-corenlp

Python wrapper for Stanford CoreNLP.
MIT License
922 stars 200 forks source link

Tregex, Semgrex, Tokensregex not working due to inverted params + missing param #21

Open marcandrelarochelle opened 6 years ago

marcandrelarochelle commented 6 years ago

Getting unknown annotator from the stanford.jar

marcandrelarochelle commented 6 years ago

{'properties': "{'annotators': 'http://localhost:9000/tregex', 'outputFormat': 'json'}", 'pipelineLanguage': 'en'}

The request is formatted like that somehow, same goes for semgrex, tokensregex

You should add a url param to _request (for tregex, semgrex, tokensregex) and in the other pos, ner, etc. change the call to _request(self.url, ......) and use the url passed by param to call the good endpoint

I also believe you need to add "pattern=" for the keyargs to work (I might be wrong here), also the params are inverted, it should be annotators first, sentence then pattern according to _request

EDIT : Created a PR