nlp.js
nlp.js copied to clipboard
Reload model.nlp on the fly
Hi I'm interested how I can re-load the model.nlp file on the fly - without need to restart the node process?
More input:
What I'm doing is, when there is no intent to which bot can answer, I look up on internet, find proper answer, then that is automatically stored in corpus.json file and new intent with u/a's. I also re-train on the fly, all changes are stored in model.nlp, but not loaded within the app until next restart.
I've tried
nlp.load('model.nlp') as well nlp.addCorpus('file.json')
but nothing seems to work.
Thanks
Yes, I would like to know too.
Right now, once I run a nlp.process(), any attempt to retrain or load a model creates a situation where any subsequent nlp.process() results with outputs from the original model rather than what I would expect from the new model, unless the utterance was an exact match to new phrases added.
Therefore, I'm finding that I also have to end the app and restart with the new model.
I've got a workaround.
Instead of const nlp = new NlpManager( options );
, I use var nlp = new NlpManager( options );
.
so that when I want to reload a different model or retrain a new model, I would first nlp = new NlpManager( options );
and immediately nlp.load('model.nlp');
BEFORE performing any nlp.process( input );
There may be a better way, but just flat out rebuilding nlp
seemed the safest.
@ScienceLion - been digging for this comment for awhile (knew I read this somewhere). Just wanted to say how much I appreciate your advice / workaround (hoping this works in browser). 🤞
Thank you big time!