Wednesday 15 February 2012

I trained the stanford NER programmatically, but got no model file -



I trained the stanford NER programmatically, but got no model file -

string prop = "austen.prop"; properties props = stringutils.propfiletoproperties(prop); string = props.getproperty("serializeto"); props.setproperty("serializeto", "c:\\ner-jxy-model.ser.gz"); seqclassifierflags flags = new seqclassifierflags(props); crfclassifier<corelabel> crf = new crfclassifier<corelabel>(flags); crf.train();

and austen.prop

#location of training file trainfile = train.tsv #location save (serialize to) #classifier; adding .gz @ end automatically gzips file, #making faster , smaller serializeto = ner-model.ser.gz #structure of training file; tells classifier #that word in column 0 , right reply in #column 1 map = word=0,answer=1 #these features we'd train #some discussed below, rest can #understood looking @ nerfeaturefactory useclassfeature=true useword=true usengrams=true #no ngrams included not contain either #beginning or end of word nomidngrams=true usedisjunctive=true maxngramleng=6 useprev=true usenext=true usesequences=true useprevsequences=true maxleft=1 #the next 4 deal word shape features usetypeseqs=true usetypeseqs2=true usetypeysequences=true wordshape=chris2uselc

i trained stanford ner programmatically, got no model file ner-model.ser.gz.

but works when straight utilize crf classify.

you need line of code after crf.train()

crf.serializeclassifier("path/to/model.ser.gz");

stanford-nlp

No comments:

Post a Comment