代码:

统计出团队中文简介中词频

import jieba

txt=open("C:\\Users\\Administrator\\Desktop\\介绍.txt","r",encoding='utf-8').read()

words=jieba.lcut(txt)

counts={}

for word in words:

if len(word)==1:

continue

else:

counts[word]=counts.get(word,0)+1

items=list(counts.items())

items.sort(key=lambda x:x[1],reverse=True)

for i in range(5):

word,count=items[i]

print("{0:<10}{1:>5}".format(word,count))

画出词频分布图:

import numpy as np

import matplotlib.pyplot as plt

fracs = [5,4,4,4,4]

labels = 'xiwang', 'daima', 'biancheng','meiyou','xingqu'

explode = [ 0.1,0,0,0,0]

plt.axes(aspect=1)

plt.pie(x=fracs, labels=labels, explode=explode,autopct='%3.1f %%',

shadow=True, labeldistance=1.1, startangle = 90,pctdistance = 0.6)

plt.show()

简介用词特点:能体现队员的特点,让大家更加充分了解每一个队员的兴趣,能力,以及想要负责的工作,更好地为团队做出贡献。

运用jieba库分词的更多相关文章

  1. 如何运用jieba库分词

    使用jieba库分词 一.什么是jieba库 1.jieba库概述 jieba是优秀的中文分词第三方库,中文文本需要通过分词获得单个词语. 2.jieba库的使用:(jieba库支持3种分词模式) 通 ...

  2. python jieba 库分词结合Wordcloud词云统计

    import jieba jieba.add_word("福军") jieba.add_word("少安") excludes={"一个", ...

  3. jieba库分词统计

    代码在github网站,https://github.com/chaigee/chaigee,中的z3.py文件 py.txt为团队中文简介文件 代码运行后词频统计使用xlwt库将数据发送到excel ...

  4. jieba库分词

    (1)团队简介的词频统计 import jieba import collections s="制作一个购票小程序,这个购票小程序可以根据客户曾经的购票历史" s+="和 ...

  5. jieba库分词词频统计

    代码已发至github上的python文件 词频统计结果如下(词频为1的词组数量已省略): {'是': 5, '风格': 4, '擅长': 4, '的': 4, '兴趣': 4, '宣言': 4, ' ...

  6. python jieba库的基本使用

    第一步:先安装jieba库 输入命令:pip install jieba jieba库常用函数: jieba库分词的三种模式: 1.精准模式:把文本精准地分开,不存在冗余 2.全模式:把文中所有可能的 ...

  7. python实例 三国人物出场次序 jieba库

    #Cal3kingdoms.py import jieba txt = open("threekingdoms.txt", "r", encoding=&quo ...

  8. python第三方库------jieba库(中文分词)

    jieba“结巴”中文分词:做最好的 Python 中文分词组件 github:https://github.com/fxsjy/jieba 特点支持三种分词模式: 精确模式,试图将句子最精确地切开, ...

  9. python 读写txt文件并用jieba库进行中文分词

    python用来批量处理一些数据的第一步吧. 对于我这样的的萌新.这是第一步. #encoding=utf-8 file='test.txt' fn=open(file,"r") ...

随机推荐

  1. 【一天一道LeetCode】#42. Trapping Rain Water

    一天一道LeetCode系列 (一)题目 Given n non-negative integers representing an elevation map where the width of ...

  2. 【一天一道LeetCode】#40. Combination Sum II

    一天一道LeetCode系列 (一)题目 Given a collection of candidate numbers (C) and a target number (T), find all u ...

  3. 在android C/C++ native编程(ndk)中使用logcat

    最近在研究Android 2.2 源代码的C/C++层,需要对代码进行一些调试,但是奇怪的是,直接添加LOGD("XXXXXXXX");,使用logcat却看不到任何输出,换成LO ...

  4. 求剁手的分享,如何简单开发js图表

    前段时间做的一个项目里需要用到js图表,在网上找了下,大概找到了highcharts.fusioncharts这些国外产品. 因为都收费,虽然有盗版,我也不敢用,万一被找上们来就砸锅卖铁了要.自己写j ...

  5. OpenCV处理视频序列的类

    代码出处,opencv2 cookbook: /*--------------------------------------------------------------------------- ...

  6. C语言笔试经典--求分数数列的和

    题目: 求数组的和    2   3/2   5/3   8/5  13/8   21/13  ...    求前20项的和 //求分数数列的和 #include<stdio.h> // ...

  7. 恶补web之二:css知识(1)

    css指层叠样式表(Cascading Style Sheets)     样式定义如何显示html元素,样式通常存储在样式表里.把样式添加到html4.0中,是为了解决内容与表现分离的问题.外部样式 ...

  8. java常用数据库连接池 (DBCP、c3p0、Druid) 配置说明

    1. 引言 1.1 定义 数据库连接是一种关键的有限的昂贵的资源,这一点在多用户的网页应用程序中体现得尤为突出.对数据库连接的管理能显著影响到整个应用程序的伸缩性和健壮性,影响到程序的性能指标.数据库 ...

  9. Spring Boot定时任务应用实践

    在Spring Boot中实现定时任务功能,可以通过Spring自带的定时任务调度,也可以通过集成经典开源组件Quartz实现任务调度. 一.Spring定时器 1.cron表达式方式 使用自带的定时 ...

  10. climbing stairs(爬楼梯)(动态规划)

    You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...