gpt4 book ai didi

python - 使用 NLTK 的 Heroku Django 应用程序 : How do I use the NLTK corpora in the app?

转载 作者:太空宇宙 更新时间:2023-11-03 17:24:32 25 4
gpt4 key购买 nike

我正在为 Django 应用程序使用 python NLTK。我在本地下载了 NLTK 语料库,一切正常。对于heroku,我尝试将语料库放入文件系统并推送到heroku(如下所述: LookupError: Resource 'corpora/stopwords' not found ),但这超出了heroku 的1GB 限制。

现在我已将语料库添加到 AWS S3 存储桶,但不知道如何将 nltk 数据导入 django 应用程序。我该怎么做?谢谢!

最佳答案

方法是将S3存储桶公开,然后使用相应的url来获取所需的对象。

例如:

pos_tagger = nltk.data.load("http://<your S3 bucket with the nltk data>.s3.amazonaws.com/nltk_data/taggers/maxent_treebank_pos_tagger/english.pickle")

关于python - 使用 NLTK 的 Heroku Django 应用程序 : How do I use the NLTK corpora in the app?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32746636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com