Lynten / stanford-corenlp

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

Specify options for annotators in properties #73

Open atulkakrana opened 5 years ago

atulkakrana commented 5 years ago

Hi, Thanks for developing this API. Here is my code to generate sentence dependencies using 'parse' annotator:

from stanfordcorenlp.corenlp import StanfordCoreNLP
nlp = StanfordCoreNLP(r'/homes/xxx/tools/stanford-corenlp-full-2018-10-05/', memory = '8g')

asent        = "The quick brown fox jumps over the lazy dog."
cons         = nlp.annotate(asent, properties={'annotators': 'parse', 'pipelineLanguage':'en','outputFormat':'json','originalDependencies':'true', 'parse.buildgraphs':'true'}) ## Tree in stanford dependency format
aparse_json  = json.loads(cons)
anno         = aparse_json["sentences"][0]
print(anno)

How can I add 'parse.nthreads' option (or any other option) for 'parse' annotator in my properties to API?