Botfuel/botfuel-dialog

Improve extractor loading

Closed this issue · 1 comments

Hello !

I faced a problem on extractors loading from Botfuel NLU. By default, all JS files into extractors directory are loaded, including files containing parent class.

The problem was that a parent class is loaded and executed while his constructor parameters are required. It returned an error.

return files.filter(file => file.match(/^.*.js$/));

I think we just have to improve this regex to allow JS files to not be loaded:

return files.filter(file => file.match(/^.*-extractor.js$/));

So, files without -extractor will not be loaded and allow us to create some-parentextractor.js for example.

Hello Simon,

TLDR: there is a short term workaround and we are redesigning entity extraction...

Short term workaround:
You can easily design your own NLU module (for example by subclassing botfuel-nlu) and implement yourself what you propose, you just need to redefine: getExtractorFiles(path)

Entity extraction redesign:
Too long to be described here but in the future, there won't be any local extractors anymore, thus the problem won't exist anymore.

As a consequence, it is very likely that we won't implement ourselves the fix you proposed.

Yan