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

install language without using snips-nlu download en #855

Closed theHazzard closed 4 years ago

theHazzard commented 4 years ago

Hi! I'm trying to deploy snips to a google cloud functions, and I can't run the command there, is there a way to add it to the requirements.txt file?

christopherhm0029 commented 4 years ago

I am having issue with the same problem every time i deploy it to the cloud heroku. Did you find any solution? thanks!

adrienball commented 4 years ago

Hi @theHazzard @christopherhm0029 The resources are packaged as python packages so you can add them to the requirements.txt file. Here is how to proceed: First, locate the resources you want on this page. Then copy the URL link to the corresponding tar.gz file and put it in your requirements.txt file, for instance:

flask==1.1.1
snips-nlu==0.20.1
https://github.com/snipsco/snips-nlu-language-resources/releases/download/snips_nlu_en-0.2.3/snips_nlu_en-0.2.3.tar.gz

At this stage, the resources will be installed as a regular python package, with a name like snips_nlu_en (or snips_nlu_<language> in general). What is left to do is to tell snips-nlu where to find the resources (when you use the CLI to download the resources, an extra linking step is performed in order to allow snips-nlu to find the resources in a default location). Here is how to instantiate your SnipsNLUEngine to make it point to the manually installed resources:

from snips_nlu import SnipsNLUEngine, load_resources

# replace "snips_nlu_en" by "snips_nlu_<language>" if you are not using english
engine = SnipsNLUEngine(resources=load_resources("snips_nlu_en"))

I hope this helps, please tell me if you still have troubles.

sarab97 commented 4 years ago

Hi @theHazzard @christopherhm0029 The resources are packaged as python packages so you can add them to the requirements.txt file. Here is how to proceed: First, locate the resources you want on this page. Then copy the URL link to the corresponding tar.gz file and put it in your requirements.txt file, for instance:

flask==1.1.1
snips-nlu==0.20.1
https://github.com/snipsco/snips-nlu-language-resources/releases/download/snips_nlu_en-0.2.3/snips_nlu_en-0.2.3.tar.gz

At this stage, the resources will be installed as a regular python package, with a name like snips_nlu_en (or snips_nlu_<language> in general). What is left to do is to tell snips-nlu where to find the resources (when you use the CLI to download the resources, an extra linking step is performed in order to allow snips-nlu to find the resources in a default location). Here is how to instantiate your SnipsNLUEngine to make it point to the manually installed resources:

from snips_nlu import SnipsNLUEngine, load_resources

# replace "snips_nlu_en" by "snips_nlu_<language>" if you are not using english
engine = SnipsNLUEngine(resources=load_resources("snips_nlu_en"))

I hope this helps, please tell me if you still have troubles.

hi i had similar issue this solved for nlu language resource but i also need to use builtin entity which has similar process and i cant get to seem that working. Can you help with that @adrienball can you help with this

adrienball commented 4 years ago

Hey @sarab97 The builtin entity resources are stored in a different place. Here are the URLs where they can be downloaded from:

Best