Using NLTK corpora with AWS Lambda functions in Python

后端 未结 4 1799
遥遥无期
遥遥无期 2021-01-02 02:20

I\'m encountering a difficulty when using NLTK corpora (in particular stop words) in AWS Lambda. I\'m aware that the corpora need to be downloaded and have done so with NLTK

4条回答
  •  攒了一身酷
    2021-01-02 02:44

    I had the same problem before but I solved it using the environment variable.

    1. Execute "nltk.download()" and copy it to the root folder of your AWS lambda application. (The folder should be called "nltk_data".)
    2. In the user interface of your lambda function (in the AWS console), you add "NLTK_DATA" = "./nltk_data". Please see the image.

提交回复
热议问题