jar - How to use Python API of Stanford NER? -


this question has answer here:

version

  • windows 7
  • python 2.7.10
  • nltk 3.1
  • stanford ner 3.6 (2015-12-09)

issue

i trained custom ner model stanford ner , got serialized model. tried using model carry out ner on unseen corpus via python api provided nltk.

according documentation, should specify path model , path stanford-ner.jar. however, need specify both path stanford-ner.jar , path slf4j-api.jar because stanford ner requires logging module.

i not figure out how specify 2 paths in nltk api. constructor takes 2 arguments first 1 path/to/model , second 1 path/to/jar. tried concatenating 2 jar paths, putting them in list , tuple none of methods worked.

how can tell nltk find both jars in order invoke prediction?

could provide code tried? looking @ source code nltk.tag.stanford module looks have initiate stanfordnertagger model , path stanford-ner jar, , logger added classpath automatically.

this __init__() method stanfordtagger superclass right after setting model , engine. looks logger jar inside parent folder of stanford-ner jar path provide , adds path implicitly calling find_jars_within_path() nltk.internals, under hood appending folder os.path


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -