Giter Site home page Giter Site logo

genwordcloud's Introduction

GenWordCloud, 面向本地文件, 在线网页, 程序输入的字符云自动生成组件,支持用户自定义图片字符形状, 生成给定网页,文本的高频词和关键词词云.

主要功能

支持三种类型的高频词和关键词可视化接口,关键词采用通用的tfidf算法提取而成。

  1. show_wordcloud_online, 根据用户输入指定网址,通过采集该网址文本进行处理
'''根据用户输入载入本地文本进行处理'''
def show_wordcloud_online(self, url, picturefile, words_num, save_name):
    content = self.get_webcontent(url)
    self.show_main(content, picturefile, words_num, save_name)
    return
  1. show_wordcloud_input, 根据用户输入文本字符串进行处理
'''根据用户输入文本进行处理'''
def show_wordcloud_input(self, content, picturefile, words_num, save_name):
    self.show_main(content, picturefile, words_num, save_name)
    return
  1. show_wordcloud_offline, 根据用户输入载入本地文本进行处理, 用户将所需处理文本文件放入text文件夹中,指定文件名称进行处理
'''根据用户输入url进行处理'''
def show_wordcloud_offline(self, textfile, picturefile, words_num, save_name):
    content = self.read_local_file(textfile)
    self.show_main(content, picturefile, words_num, save_name)
    return

运行方式

参数:

  1. textfile: 放于text文件夹中, 为用户需要分析的文本
  2. picturefile: 放于background文件夹中, 为用户给定的图片源文件
  3. url: 用户需要进行分析网页文本的url
  4. content: 用户需要分析的文本字符串
  5. save_name: 用户对当前分析目标的命名
  6. word_num: 用户希望展示的词数

输出: 在output文件夹下会生成以save_name开头的高频词云图和关键词云图

textfile = 'beijing.txt'
picturefile = 'china.jpg'
url = 'https://news.sina.com.cn/c/2020-07-26/doc-iivhuipn5142014.shtml'
content = '''
。。。。。。。。。。。。略
'''
save_name = 'Trump'
words_num = 50
handler = CreateWordCloud()
handler.show_wordcloud_input(content, picturefile, words_num, save_name)
handler.show_wordcloud_online(url, picturefile, words_num, save_name)
handler.show_wordcloud_offline(textfile, picturefile, words_num, save_name)

genwordcloud's People

Contributors

kevin2018pg avatar

Watchers

James Cloos 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.