GithubHelp home page GithubHelp logo

words_image's Introduction

生成图形词云

使用jieba和wordcloud生成图形词云

安装

pip install -r requirements.txt

使用

from words_image import generate_image
import os

base_dir = os.path.dirname(__file__)
# 定义文本文件夹路径
words_dir = os.path.join(base_dir, "data")
# 定义图形的图片路径
# 其中图片中白色的部分会被忽略
image_name = os.path.join(base_dir, "tony.png")

if __name__ == "__main__":
     # 获取文件夹下所有文本路径
     files = []
     for f in os.listdir(words_dir):
         full_f = os.path.join(words_dir, f)
         if os.path.isfile(full_f):
             files.append(full_f)
     # 生成词云
     generate_image(files, image_name)

示例

路飞

luffy_word

乔巴

tony_words

words_image's People

Contributors

flingjie avatar

Watchers

 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.