snipsco / snips-nlu

Snips Python library to extract meaning from text
https://snips-nlu.readthedocs.io
Apache License 2.0
3.89k stars 513 forks source link

Missing slots with downloaded nlu engine using snips_nlu #818

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi,

I’ve created an assistant via console, and downloaded it. When I test the queries via console, it returns the right slots, however, when I load the downloaded assistant, it gets the intents right, but misses most of the slots for the same queries tested in console.

Am I missing something? When loading via from_path(), I point to the assistant’s nlu_engine folder.

from snips_nlu import SnipsNLUEngine
import sys
import json

def main(argv):
    nlu_engine = SnipsNLUEngine.from_path(argv[1])

    try:
        while True:
            text = input('> ')
            parsing = nlu_engine.parse(text)
            print(json.dumps(parsing, indent=2))
    except KeyboardInterrupt:
        pass

if __name__ == '__main__':
    main(sys.argv)
adrienball commented 5 years ago

Hi @demirhere, Which version of snips_nlu are you using ? You should make sure you are using the latest version by running pip install --upgrade snips-nlu.

The assistant gets retrained right before it is downloaded, and this process may produce a slightly difference NLU engine than the one you tested before in the console. If your intents contain enough utterances, you should see consistent results from one training to another. However, if you have provided too few utterances (<10~20) for some intents, then your assistant may be a bit unstable.