I am attempting to create a Python transform that requires me to import nltk. When I import nltk, later on I get:
Resource [93mpunkt_tab[0m not found.
Please use the NLTK Downloader to obtain the resource:
[31m>>> import nltk
>>> nltk.download('punkt_tab') [0m For more information see: .html
Attempted to load [93mtokenizers/punkt_tab/english/[0m
So putting the download code within Foundry doesn't seem to work even though I could do it in my local code, that is:
nltk.download()
So I was trying to download all the required files locally and then upload an nltk_data
folder to the same level as my Code Workbook. Then I wanted to add the location of the nltk_data
folder to the Python path but that does not seem to work. How do I do this, get the location of the newly uploaded folder into the Python path? Do I somehow use the RID for the folder? When I do a python walk for the /
directory, I can't find nltk_data
As a final note, I am not an admin, so any approaches to do this have to be as a non-admin user. It seems like such a simple use case, but I guess Foundry abstracts away the file system.
I am attempting to create a Python transform that requires me to import nltk. When I import nltk, later on I get:
Resource [93mpunkt_tab[0m not found.
Please use the NLTK Downloader to obtain the resource:
[31m>>> import nltk
>>> nltk.download('punkt_tab') [0m For more information see: https://www.nltk./data.html
Attempted to load [93mtokenizers/punkt_tab/english/[0m
So putting the download code within Foundry doesn't seem to work even though I could do it in my local code, that is:
nltk.download()
So I was trying to download all the required files locally and then upload an nltk_data
folder to the same level as my Code Workbook. Then I wanted to add the location of the nltk_data
folder to the Python path but that does not seem to work. How do I do this, get the location of the newly uploaded folder into the Python path? Do I somehow use the RID for the folder? When I do a python walk for the /
directory, I can't find nltk_data
As a final note, I am not an admin, so any approaches to do this have to be as a non-admin user. It seems like such a simple use case, but I guess Foundry abstracts away the file system.
Share Improve this question edited Mar 12 at 12:01 omnes_flumina asked Mar 12 at 11:51 omnes_fluminaomnes_flumina 296 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0So if one had admin access (and as I said I don't and would like an answer as such) the best path is probably
* Configure the environment in code workbook
* Add nltk_data as a package which will have visibility. (This is the portion that has to be done by admin, making the package available)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744754493a4591798.html
nltk.data.path
– furas Commented Mar 12 at 12:06nltk.data.path
with – omnes_flumina Commented Mar 12 at 12:11nltk.data.path.append(...)
?nltk.data.path.insert(0, ...)
? – furas Commented Mar 12 at 12:12