axa-group / nlp.js

An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Pick a answer(s) from a intent.

MarketingPip opened this issue · comments

It would be more than ideal if the API could expose a way to choose a random answer from the / a corpus via intent name from provided string.

I know I can get the answer via OnIntent.answer tho not sure - can't seem to find where keys are stored for corpus.

I tried looking through the source code to see if I could make any progress on this but could not seem to figure it out! With some guidance I could possibly make a PR for this.

Ideally it would look something like nlp.getIntent(`name`) with a returned object of something like

{
intent:IntentName,
answer:Random, // random via length etc.. 
answers:[
ALL ANSWERS
].
}

I will try to suggest any other features / suggestions when they come to mind! 👍

Off topic: I also seen the it was asked about for support to export corpus data via web. If I can get a pointer / snippet of where the JSON gets created so I can work off that I will try to add a feature / tool to export corpus via browser. I seen where things get sent to the file system module to export. But could not see where the model was turned into JSON. Would be great if I can get the line to where to find the JSON only so I can work with that etc.