java - How to use serialized CRFClassifier with StanfordCoreNLP prop 'ner' -


i'm using stanfordcorenlp api interface programmatically basic nlp. need train model on own corpus, i'd use stanfordcorenlp interface it, because handles lot of dry mechanics behind scenes , don't need specialization there.

i've trained crfclassifier i'd use ner, serialized file. based on documentation, i'd think following work, doesn't seem find model , instead barfs on not being able find standard models (i'm not sure why don't have model files, i'm not concerned since don't want use them anyway):

    // string constants     final string serializedclassifierfilename = "/absolute/path/to/model.ser.gz";      properties props = new properties();     props.setproperty("annotators", "tokenize, ssplit, ner");     props.setproperty("ner.models", serializedclassifierfilename);      stanfordcorenlp pipeline = new stanfordcorenlp(props);      string filecontents = ioutils.slurpfilenoexceptions("test.txt");     annotation document = new annotation(filecontents); 

results in:

adding annotator tokenize tokenizerannotator: no tokenizer type provided. defaulting ptbtokenizer. adding annotator ssplit adding annotator ner loading classifier /path/build/edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... java.io.filenotfoundexception: edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz (no such file or directory)     @ java.io.fileinputstream.open0(native method)     @ java.io.fileinputstream.open(fileinputstream.java:195)     @ java.io.fileinputstream.<init>(fileinputstream.java:138)     @ edu.stanford.nlp.ie.abstractsequenceclassifier.loadclassifier(abstractsequenceclassifier.java:1554) 

etc., etc.

i know don't have built-in model (again, not sure why.. cloned git repo , compiled ant compile. regardless, don't want use model anyway, want use 1 trained).

how can stanfordcorenlp interface use model in ner step? possible? not possible?

the property name ner.model, not ner.models, code still trying load default models.

let me know if documented incorrectly somewhere.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -