Commit 3a87e3b6 authored by Indrek Jentson's avatar Indrek Jentson

word_cloud projekti koodi uuendamine värskeima versiooniga

parent 5441ae57
version: 2
references:
ci_steps: &ci_steps
working_directory: /work
steps:
- checkout
- run:
name: Run CI
command: |
#
# Set UPLOAD_SDIST environment variable
#
export UPLOAD_SDIST=$(echo ${CIRCLE_JOB} | cut -d"_" -f3)
echo "UPLOAD_SDIST [${UPLOAD_SDIST}]"
#
# Run CI
#
export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2)
echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]"
/opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci
/opt/python/${MANYLINUX_PYTHON}/bin/ci
- persist_to_workspace:
root: ./
paths:
- dist
x64_build_job: &x64_build_job
docker:
- image: dockcross/manylinux-x64
<<: *ci_steps
x86_build_job: &x86_build_job
docker:
- image: dockcross/manylinux-x86
<<: *ci_steps
deploy_website_command: &deploy_website_command
name: Deploy website
command: |
source_sha=$(cat doc/_build/html/.buildinfo | grep sha | cut -d: -f2)
repo_slug=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
doc/deploy-website.sh $repo_slug $source_sha --html-dir doc/_build/html
no_filters: &no_filters
filters:
tags:
only: /.*/
jobs:
# x64
manylinux-x64_cp27-cp27m:
<<: *x64_build_job
manylinux-x64_cp27-cp27mu:
<<: *x64_build_job
manylinux-x64_cp34-cp34m:
<<: *x64_build_job
manylinux-x64_cp35-cp35m:
<<: *x64_build_job
manylinux-x64_cp36-cp36m_upload-sdist:
<<: *x64_build_job
manylinux-x64_cp37-cp37m:
<<: *x64_build_job
# x86
#manylinux-x86_cp27-cp27m:
# <<: *x86_build_job
#manylinux-x86_cp27-cp27mu:
# <<: *x86_build_job
#manylinux-x86_cp34-cp34m:
# <<: *x86_build_job
#manylinux-x86_cp35-cp35m:
# <<: *x86_build_job
#manylinux-x86_cp36-cp36m:
# <<: *x86_build_job
#manylinux-x86_cp37-cp37m:
# <<: *x86_build_job
build-website_cp37-cp37m:
docker:
- image: circleci/python:3.7.0-stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Build website
command: |
export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2)
echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]"
python -m venv ../venv
. ../venv/bin/activate
pip install ./dist/*${MANYLINUX_PYTHON}*x86_64.whl
doc/build-website.sh
- persist_to_workspace:
root: ./
paths:
- doc/_build/html
deploy-master:
docker:
- image: circleci/python:3.7.0-stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Deploy master
command: |
echo "Deploy master (not implemented)"
- run:
<<: *deploy_website_command
deploy-release:
docker:
- image: circleci/python:3.7.0-stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Deploy release
command: |
echo "Deploy release"
python -m venv ../venv
. ../venv/bin/activate
pip install twine
ls dist
twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
- run:
<<: *deploy_website_command
workflows:
version: 2
build-test-deploy:
jobs:
# x64
- manylinux-x64_cp27-cp27m:
<<: *no_filters
- manylinux-x64_cp27-cp27mu:
<<: *no_filters
- manylinux-x64_cp34-cp34m:
<<: *no_filters
- manylinux-x64_cp35-cp35m:
<<: *no_filters
- manylinux-x64_cp36-cp36m_upload-sdist:
<<: *no_filters
- manylinux-x64_cp37-cp37m:
<<: *no_filters
# x86
#- manylinux-x86_cp27-cp27m:
# <<: *no_filters
#- manylinux-x86_cp27-cp27mu:
# <<: *no_filters
#- manylinux-x86_cp34-cp34m:
# <<: *no_filters
#- manylinux-x86_cp35-cp35m:
# <<: *no_filters
#- manylinux-x86_cp36-cp36m:
# <<: *no_filters
#- manylinux-x86_cp37-cp37m:
# <<: *no_filters
- build-website_cp37-cp37m:
requires:
- manylinux-x64_cp37-cp37m
<<: *no_filters
- deploy-master:
requires:
# x64
- manylinux-x64_cp27-cp27m
- manylinux-x64_cp27-cp27mu
- manylinux-x64_cp34-cp34m
- manylinux-x64_cp35-cp35m
- manylinux-x64_cp36-cp36m_upload-sdist
- manylinux-x64_cp37-cp37m
# x86
#- manylinux-x86_cp27-cp27m
#- manylinux-x86_cp27-cp27mu
#- manylinux-x86_cp34-cp34m
#- manylinux-x86_cp35-cp35m
#- manylinux-x86_cp36-cp36m
#- manylinux-x86_cp37-cp37m
# misc
- build-website_cp37-cp37m
filters:
branches:
only: master
- deploy-release:
requires:
# x64
- manylinux-x64_cp27-cp27m
- manylinux-x64_cp27-cp27mu
- manylinux-x64_cp34-cp34m
- manylinux-x64_cp35-cp35m
- manylinux-x64_cp36-cp36m_upload-sdist
- manylinux-x64_cp37-cp37m
# x86
#- manylinux-x86_cp27-cp27m
#- manylinux-x86_cp27-cp27mu
#- manylinux-x86_cp34-cp34m
#- manylinux-x86_cp35-cp35m
#- manylinux-x86_cp36-cp36m
#- manylinux-x86_cp37-cp37m
# misc
- build-website_cp37-cp37m
filters:
tags:
only: /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
branches:
ignore: /.*/
wordcloud/_version.py export-subst
build
wordcloud/query_integral_image.so
*.pyc
*~
doc/_build
doc/auto_examples
doc/gen_modules
doc/generated
.project
.pydevproject
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
# Created by https://www.gitignore.io/api/pycharm,python,visualstudiocode
# Edit at https://www.gitignore.io/?templates=pycharm,python,visualstudiocode
### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
### Python Patch ###
.venv/
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
# End of https://www.gitignore.io/api/pycharm,python,visualstudiocode
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
branches:
only:
- master
- /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
language: python
sudo: false
addons:
apt:
packages:
# Only used by the DISTRIB="ubuntu" setting
- python-numpy
virtualenv:
system_site_packages: true
env:
matrix:
- DISTRIB="ubuntu" PYTHON_VERSION="2.7"
# This environment tests the oldest supported anaconda env
- DISTRIB="conda" PYTHON_VERSION="2.7" NUMPY_VERSION="1.7.1"
- DISTRIB="conda" PYTHON_VERSION="3.4" NUMPY_VERSION="1.11.2"
- DISTRIB="conda" PYTHON_VERSION="3.6" NUMPY_VERSION="1.11.2"
install: source continuous_integration/install.sh
cache: apt
script: nosetests
matrix:
include:
- os: osx
language: generic
env:
- PYTHON_VERSION=3.7.0
- os: osx
language: generic
env:
- PYTHON_VERSION=3.6.5
- os: osx
language: generic
env:
- PYTHON_VERSION=3.5.5
- os: osx
language: generic
env:
- PYTHON_VERSION=3.4.8
- os: osx
language: generic
env:
- PYTHON_VERSION=2.7.15
cache:
directories:
- $HOME/.pyenv/versions/3.7.0
- $HOME/.pyenv/versions/3.6.5
- $HOME/.pyenv/versions/3.5.5
- $HOME/.pyenv/versions/3.4.8
- $HOME/.pyenv/versions/2.7.15
- $HOME/downloads
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python; fi
- python -m pip install --disable-pip-version-check --upgrade pip
- pip install -U scikit-ci scikit-ci-addons
- ci_addons --install ../addons
install:
- ci install
script:
- ci test
after_success:
- ci after_test
deploy:
# deploy-release
- provider: script
script: pwd && ls dist;echo "deploy-release" && ~/.pyenv/versions/${PYTHON_VERSION}/bin/twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
skip_cleanup: true
on:
repo: ${TRAVIS_REPO_SLUG}
tags: true
# deploy-master
- provider: script
script: pwd && ls dist;echo "deploy-master" && echo "not implemented"
skip_cleanup: true
on:
repo: ${TRAVIS_REPO_SLUG}
branch: master
#### Description
<!-- Example: Duplicate words shown when input is sorted list -->
#### Steps/Code to Reproduce
<!--
It's unlikely your issue can be resolved unless you provide
a short, self contained correct example to reproduce (see http://sscce.org/).
Example:
```python
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from wordcloud import WordCloud
a = 'this is a wordcloud show test'
wc = WordCloud().generate(a)
wc.to_file('wc.jpg')
plt.imshow(wc)
plt.axis('off')
plt.savefig('plt.png')
```
If the code is too long, feel free to put it in a public gist and link
it in the issue: https://gist.github.com
-->
#### Expected Results
<!-- Example: No error is thrown. Please paste or describe the expected results.-->
#### Actual Results
<!-- Please paste or specifically describe the actual output or traceback. -->
#### Versions
<!--
Please run the following snippet and paste the output below.
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import matplotlib; print("matplotlib", matplotlib.__version__)
import wordcloud; print("wordcoud", wordcloud.__version__)
-->
<!-- Thanks for contributing! -->
include versioneer.py
include wordcloud/_version.py
[![Build Status](https://travis-ci.org/amueller/word_cloud.png)](https://travis-ci.org/amueller/word_cloud)
[![licence](http://img.shields.io/badge/licence-MIT-blue.svg?style=flat)](https://github.com/amueller/word_cloud/blob/master/LICENSE)
[![DOI](https://zenodo.org/badge/21369/amueller/word_cloud.svg)](https://zenodo.org/badge/latestdoi/21369/amueller/word_cloud)
| | Linux | macOS | Windows |
|------|----------------------------------------------|----------------------------------------------|----------------------------------------------|
| PyPI | [![CircleCI][circleci_image]][circleci_link] | [![TravisCI][travisci_image]][travisci_link] | [![AppVeyor][appveyor_image]][appveyor_link] |
[circleci_link]: https://circleci.com/gh/amueller/word_cloud/tree/master
[circleci_image]: https://circleci.com/gh/amueller/word_cloud/tree/master.svg?style=svg
[travisci_link]: https://travis-ci.org/amueller/word_cloud
[travisci_image]: https://travis-ci.org/amueller/word_cloud.svg?branch=master
[appveyor_link]: https://ci.appveyor.com/project/amueller/word-cloud/branch/master
[appveyor_image]: https://img.shields.io/appveyor/ci/amueller/word-cloud/master.svg
word_cloud
==========
A little word cloud generator in Python. Read more about it on the [blog
post][blog-post] or the [website][website].
The code is Python 2, but Python 3 compatible.
The code is tested against Python 2.7, 3.4, 3.5, 3.6 and 3.7.
## Installation
Fast install:
If you are using pip:
pip install wordcloud
If you are using conda, it might be even easier to use anaconda cloud:
If you are using conda, you can install from the `conda-forge` channel:
conda install -c https://conda.anaconda.org/amueller wordcloud
conda install -c conda-forge wordcloud
For a manual install get this package:
wget https://github.com/amueller/word_cloud/archive/master.zip
unzip master.zip
rm master.zip
cd word_cloud-master
Install the package:
#### Installation notes
python setup.py install
wordcloud depends on `numpy` and `pillow`.
If you're having trouble with pip installation on windows, you can find a .whl file at:
To save the wordcloud into a file, `matplotlib` can also be installed. See [examples](#examples) below.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloud
If there are no wheels available for your version of python, installing the
package requires having a C compiler set up. Before installing a compiler, report
an issue describing the version of python and operating system being used.
Note that if you are not on Ubuntu, you need to pass a ``font_path`` to the WordCloud object ([docs](http://amueller.github.io/word_cloud/generated/wordcloud.WordCloud.html#wordcloud.WordCloud)) to point to
some existing font.
## Examples
......@@ -55,53 +60,17 @@ Getting fancy with some colors:
## Command-line usage
The `wordcloud_cli.py` tool can be used to generate word clouds directly from the command-line:
The `wordcloud_cli` tool can be used to generate word clouds directly from the command-line:
$ wordcloud_cli.py --text mytext.txt --imagefile wordcloud.png
$ wordcloud_cli --text mytext.txt --imagefile wordcloud.png
If you're dealing with PDF files, then `pdftotext`, included by default with many Linux distribution, comes in handy:
$ pdftotext mydocument.pdf - | wordcloud_cli.py --imagefile wordcloud.png
$ pdftotext mydocument.pdf - | wordcloud_cli --imagefile wordcloud.png
In the previous example, the `-` argument orders `pdftotext` to write the resulting text to stdout, which is then piped to the stdin of `wordcloud_cli.py`.
Use `wordcloud_cli.py --help` so see all available options.
## Used in
### Reddit Cloud
[Reddit Cloud][reddit-cloud] is a Reddit bot which generates word clouds for
comments in submissions and user histories. You can see it being operated on
[/u/WordCloudBot2][wc2] ([top posting][wc2top]).
![A Reddit Cloud sample](http://i.imgur.com/tcbZnKW.png)
### Chat Stats (Twitch.tv)
[Chat Stats][chat-stats] is a visualization program for Twitch streams,
which generates word clouds for comments made by Twitch users in the chat.
It also creates various charts and graphs pertaining to concurrent viewership
and chat rate over time.
![Chat Stats Sample](http://i.imgur.com/xBczk0x.png)
### Twitter Word Cloud Bot
[Twitter Word Cloud Bot][twitter-word-cloud-bot] is a twitter bot which generates
word clouds for twitter users when it is mentioned with a particular hashtag.
[Here][twitter-wordnuvola] you can see it in action, while [here][imgur-wordnuvola]
you can see all the word clouds generated so far.
### [other]
*Send a pull request to add yours here.*
## Issues
Using Pillow instead of PIL might might get you the [`TypeError: 'int' object is
not iterable` problem][intprob] also showcased on the blog.
Use `wordcloud_cli --help` so see all available options.
[blog-post]: http://peekaboo-vision.blogspot.de/2012/11/a-wordcloud-in-python.html
[website]: http://amueller.github.io/word_cloud/
......
branches:
only:
- master
- /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
version: "0.0.1.{build}"
environment:
matrix:
# - PYTHON_DIR: "C:\\Python27"
# PYTHON_VERSION: "2.7.x"
# PYTHON_ARCH: "32"
# BLOCK: "0"
- PYTHON_DIR: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
BLOCK: "0"
# - PYTHON_DIR: "C:\\Python34"
# PYTHON_VERSION: "3.4.x"
# PYTHON_ARCH: "32"
# BLOCK: "0"
- PYTHON_DIR: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "64"
BLOCK: "0"
# - PYTHON_DIR: "C:\\Python35"
# PYTHON_VERSION: "3.5.x"
# PYTHON_ARCH: "32"
# BLOCK: "0"
- PYTHON_DIR: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
BLOCK: "0"