Code Monkey home page Code Monkey logo

wordcloud-docker's Introduction

Wordcloud as a Docker image

CircleCI Build main or features

This repo encapsulates Wordcloud as a simple Docker image.

The current version at Docker Hub is 1.6. Just docker pull koenighotze/wordcloud:1.6 to get started.

Building

Building from scratch is easy as:

$ docker build -t koenighotze/wordcloud .
...
Step 17/17 : CMD ["--help"]
 ---> Using cache
 ---> e743d10ddadc
Successfully built e743d10ddadc
Successfully tagged koenighotze/wordcloud:latest

Running

The entrypoint is set to wordcloud_cli. To see to online help, run the image as

$ docker run --rm=true  koenighotze/wordcloud:1.6

usage: wordcloud_cli [-h] [--text file] [--regexp regexp] [--stopwords file]
...
  --include_numbers include_numbers
                        include numbers in wordcloud?
  --min_word_length min_word_length
                        only include words with more than X letters
  --version             show program's version number and exit

Let's create the word cloud based on the Bash manual. We paste the manual into a text file and use a bind volume to expose that text file to the container. Then we ask Wordcloud to generate the cloud-image and store it in the same bind-volume.

Note, that since the entrypoint of the image is wordcloud_cli, we can pass any arguments directly to the running container.

$ man bash > sample/bash_man.txt
# sample/bash_man.txt contains the complete manual for the Bash shell, now
$ docker run \
    --rm=true  \
    # remove the container after execution - no need to keep it around
    -v $(PWD)/sample:/data/ \
    # we mount the sample directory at /data/ within the container using a bind
    # volume.
    koenighotze/wordcloud:1.6 \
    --min_word_length 5 \
    # exclude any words shorter than 5 characters in length
    --text /data/bash_man.txt \
    # location of the text used for generating the word cloud
    --imagefile /data/wordcloud.png
    # location of the generated image

We can now open the image, e.g. on Mac using open ./sample/wordcloud.png.

wordcloud-docker's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.