Share the NLP system

Here is a skill:

export default {
    nlp: {
        regexp: {
            hey(str) {
                return /hello/i.test(str)
            }
        }
    }
}

It contains an NLP system based on one of the regular expressions. Of course, our example is very simple. However, we want to use this NLP in the parent skill. For this, we use the shareNlp property

export default {
    nlp: {
        regexp: {
            hey(str) {
                return /hello/i.test(str)
            }
        }
    },
    shareNlp: true
}

In the parent skill:

import code from './main.converse'
import mySkill from './skills/my-skill'

export default {
    code,
    skills: {
        mySkill
    }
}

We can listen to the intentions:

main.converse

@Intent('hey') 
hey() {
    > Hi !
}

Last updated