Coder Social home page Coder Social logo

nltk_data is absent about alpine-anaconda3 HOT 2 CLOSED

alex-ber avatar alex-ber commented on July 20, 2024
nltk_data is absent

from alpine-anaconda3.

Comments (2)

alex-ber avatar alex-ber commented on July 20, 2024

As work-around use

import pandas as pd 
import re  
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
print(stopwords.words('english'))

Alternatively inherit from my dockerfile and add:

#nltk-data
RUN set -ex && python -m nltk.downloader -d /usr/share/nltk_data all

In place of /usr/share/nltk_data you can use any of the following path:

  • '/root/nltk_data'
  • '/opt/anaconda3/nltk_data'
  • '/opt/anaconda3/share/nltk_data'
  • '/opt/anaconda3/lib/nltk_data'
  • '/usr/share/nltk_data'
  • '/usr/local/share/nltk_data'
  • '/usr/lib/nltk_data'
  • '/usr/local/lib/nltk_data'

Note: You can set NLTK_DATA environment variable to point to your top level nltk_data folder.
However, there many pitfalls in this process, so I'm recommended to use one of the standard locations.

from alpine-anaconda3.

alex-ber avatar alex-ber commented on July 20, 2024

nltk_data takes too much place, so I've decided not to include it to my dockerfile.

If you need it, usually, you will need only some small subset of it, download it youself or by creating custom image (you will do it only once, well, per dockerfile built) o_r directly in the Python code_ (it will be re-downloading every time you will restart your docker container; every code run, check will be done, whether filles was changed). See previous post for details.

from alpine-anaconda3.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.