Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vaaaaanquish/cloudia
Tools to easily create a word cloud
https://github.com/vaaaaanquish/cloudia
Last synced: 3 months ago
JSON representation
Tools to easily create a word cloud
- Host: GitHub
- URL: https://github.com/vaaaaanquish/cloudia
- Owner: vaaaaanquish
- License: mit
- Created: 2020-04-28T10:33:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-28T03:11:23.000Z (almost 4 years ago)
- Last Synced: 2024-04-14T07:20:45.563Z (7 months ago)
- Language: Python
- Size: 346 KB
- Stars: 115
- Watchers: 7
- Forks: 11
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Cloudia
Tools to easily create a word cloud.
### from stringfrom str or List[str]
```
from cloudia import Cloudiatext1 = "text data..."
text2 = "text data..."# from str
Cloudia(text1).plot()# from list
Cloudia([text1, text2]).plot()
```
example from : [20 Newsgroups](http://qwone.com/~jason/20Newsgroups/)![sample_img](https://github.com/vaaaaanquish/cloudia/blob/021a6d151fb6a3b579dc96b7086356fc0c225852/examples/img/sample_img.png?raw=true, "sample_img")
We can also make it from Tuple.
```
from cloudia import Cloudiatext1 = "text data..."
text2 = "text data..."
Cloudia([ ("cloudia 1", text1), ("cloudia 2", text2) ]).plot()
```
Tuple is ("IMAGE TITLE", "TEXT").
### from pandasWe can use pandas.
```
df = pd.DataFrame({'wc1': ['sample1','sample2'], 'wc2': ['hoge hoge piyo piyo fuga', 'hoge']})# plot from df
Cloudia(df).plot()# add df method
df.wc.plot(dark_theme=True)
```from pandas.DataFrame or pandas.Series.
![pandas_img](https://github.com/vaaaaanquish/cloudia/blob/021a6d151fb6a3b579dc96b7086356fc0c225852/examples/img/pandas_img.png?raw=true, "pandas_img")
![dark_img](https://github.com/vaaaaanquish/cloudia/blob/021a6d151fb6a3b579dc96b7086356fc0c225852/examples/img/dark_img.png?raw=true, "dark_img")
We can use Tuple too.
```
Cloudia( ("IMAGE TITLE", pd.Series(['hoge'])) ).plot()
```
### from japaneseWe can process Japanese too.
```
text = "これはCloudiaのテストです。WordCloudをつくるには本来、形態素解析の導入が必要になります。Cloudiaはmecabのような形態素解析器の導入は必要はなくnagisaを利用した動的な生成を行う事ができます。nagisaとjapanize-matplotlibは、形態素解析を必要としてきたWordCloud生成に対して、Cloudiaに対して大きく貢献しました。ここに感謝の意を述べたいと思います。"Cloudia(text).plot()
```from japanese without morphological analysis module.
![japanese_img](https://github.com/vaaaaanquish/cloudia/blob/021a6d151fb6a3b579dc96b7086356fc0c225852/examples/img/japanese_img.png?raw=true, "jap_img")
No need to introduce morphological analysis.
# Install```
pip install cloudia
```
# ArgsCloudia args.
```
Cloudia(
data, # text data
single_words=[], # It's not split word list, example: ["neural network"]
stop_words=STOPWORDS, # not count words, default is wordcloud.STOPWORDS
extract_postags=['名詞', '英単語', 'ローマ字文'], # part of speech for japanese
parse_func=None, # split text function, example: lambda x: x.split(',')
multiprocess=True, # Flag for using multiprocessing
individual=False # flag for ' '.join(word) with parse
)
```
plot method args.
```
Cloudia().plot(
dark_theme=False, # color theme
title_size=12, # title text size
row_num=3, # for example, 12 wordcloud, row_num=3 -> 4*3image
figsize_rate=2 # figure size rate
)
```save method args.
```
Cloudia().save(
file_path, # save figure image path
dark_theme=False,
title_size=12,
row_num=3,
figsize_rate=2
)
```pandas.DataFrame, pandas.Series wc.plot method args.
```
DataFrame.wc.plot(
single_words=[], # It's not split word list, example: ["neural network"]
stop_words=STOPWORDS, # not count words, default is wordcloud.STOPWORDS
extract_postags=['名詞', '英単語', 'ローマ字文'], # part of speech for japanese
parse_func=None, # split text function, example: lambda x: x.split(',')
multiprocess=True, # Flag for using multiprocessing
individual=False, # flag for ' '.join(word) with parse
dark_theme=False, # color theme
title_size=12, # title text size
row_num=3, # for example, 12 wordcloud, row_num=3 -> 4*3image
figsize_rate=2 # figure size rate
)
```
If we use wc.save, setting file_path args.
# Thanks- [japanize-matplotlib](https://github.com/uehara1414/japanize-matplotlib)
- [nagisa](https://github.com/taishi-i/nagisa)