- 博客(29)
- 资源 (3)
- 问答 (2)
- 收藏
- 关注
原创 Python 基于Snownlp的情感分析(简单)
from snownlp import SnowNLP# 需要操作的句子file=open('text2.txt',mode='r')str=file.readline()str=str.replace('。','。\n')ls=str.split('\n')print(ls)def word_seg(str): ls1 = SnowNLP(str).words r...
2020-03-29 00:34:33 2007 1
原创 python 新词发现
wordseg.py:#coding=utf-8"""基于信息熵和互信息非监督中文分词Reference: http://www.matrix67.com/blog/archives/5044"""import reimport mathimport jsondef entropyOfList(ls): """ 给到一个列表(词,频次), 计算熵,用于...
2020-03-26 15:30:58 548
转载 Python 新词发现
https://blog.csdn.net/weixin_43378396/article/details/103848628?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158514844019724811845128%2522%252C%2522scm%2522%253A%252220140713.130056874..%25...
2020-03-26 00:18:37 931
原创 Python 手写tf-idf(2)
#encoding:utf-8from collections import defaultdictfrom collections import Counterimport jiebaimport mathimport osdef read_single_file(file_name): #lines=[line.strip() for line in open(file_...
2020-03-24 15:27:22 229
转载 textrank 关键词提取-python实现
https://blog.csdn.net/y12345678904/article/details/77855936?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
2020-03-23 22:17:28 781
转载 python中join()函数的使用方法
https://www.cnblogs.com/sui776265233/p/10755525.html
2020-03-19 14:18:57 280
转载 python中去掉字符串中的\xa0、\t、\n,\u3000
https://blog.csdn.net/wangbowj123/article/details/78061618?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
2020-03-19 14:06:18 2596
原创 python 爬虫并把网页中的文字写到txt中
import requestsfrom bs4 import BeautifulSoupfrom lxml import etreelink='http://www.chinanews.com/gn/2020/03-18/9129903.shtml'header={ 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) A...
2020-03-18 23:16:14 2543
原创 python实战 豆瓣电影关键字爬虫
import requestsfrom bs4 import BeautifulSoupdef get_moves(): header = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0;Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/...
2020-03-18 21:24:58 498
原创 python requests如何看header
使用chrome浏览器自带的开发者工具查看http头的方法1.在网页任意地方右击选择审查元素或者按下 shift+ctrl+c, 打开chrome自带的调试工具;2.选择network标签, 刷新网页(在打开调试工具的情况下刷新);3.刷新后在左边找到该网页url,点击 后右边选择headers,就可以看到当前网页的http头了;...
2020-03-18 20:55:22 2825
原创 python对字典排序
import operatorx={1:2,3:4,4:3,2:1,0:0}sorted_x=sorted(x.items(),key=operator.itemgetter(1))print(sorted_x)
2020-03-18 20:33:46 140
原创 python小爬虫书写格式
import requestsfrom bs4 import BeautifulSouplink="https://3w.huanqiu.com/a/a4d1ef/3xT9bm0bPnl?agt=20&tt_group_id=6805406628087595533"headers={'User-Agent':'Mozilla/5.0(Windows;U;Windows NT 6...
2020-03-18 20:23:45 305
转载 python注释快捷键和取消注释快捷键
https://blog.csdn.net/u010590983/article/details/88087959
2020-03-18 20:04:24 4536
转载 Python中报错提示:TypeError: Student() takes no arguments
https://blog.csdn.net/xuantaiyang888/article/details/81035885
2020-03-18 19:17:26 2893
转载 “You are using pip version 19.0.3, however version 20.0.2 is available.”pip 更新报错解决办法
https://www.cnblogs.com/helloLuoLuo/p/12468732.html
2020-03-17 19:44:26 387
原创 考研数学 经验
数学:经历:高数部分初期:刚开始觉得自己数学基础不错,直接看李王全书,结果看完一遍感觉好像啥都没看一样,很懵逼。于是去借了教科书,根据自己的理解把知识点抄到本子,再听张宇的基础班视频一边做笔记,一遍之后感觉知识点清晰很多。马上重新拿起李王全书,高数部分一题一题看,会做自己写出来,不会的话一边看答案一边思索解法的奥妙。全书看完刷660题,那题目简直了,基本都得做几题,翻一次答案。线代...
2020-03-16 10:41:28 1023
转载 ACM标准输入输出C/C++版
https://blog.csdn.net/qiao1245/article/details/53020326?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
2020-03-15 16:53:00 59
原创 python 中文分词去停留词,提取关键字。
from collections import defaultdictimport jiebaimport math#取出停用词表def stopwordlist(): stopwords = [line.strip() for line in open('chinesestoptxt.txt', encoding='UTF-8').readlines()] retur...
2020-03-09 12:09:03 1568 2
原创 python 中文分词和去停用词
import jieba#取出停用词表def stopwordlist(): stopwords = [line.strip() for line in open('chinesestoptxt.txt', encoding='UTF-8').readlines()] return stopwords#分词并去停用词def seg_word(line): seg...
2020-03-09 09:53:41 2477 5
原创 python 用结巴(jieba)进行中文分词
import jiebafilename="01.txt"file=open(filename,encoding='UTF-8',mode='r')ls=[]for i in file.readlines(): j=jieba.cut(i,cut_all=False) ls.append('/'.join(j))print(ls)
2020-03-08 22:02:17 352
原创 python 逗号分隔句子
filename="01.txt"file=open(filename,encoding='UTF-8',mode='r+')ls=[]lines=file.read()file.close()ls=lines.split('。')print(ls)file=open(filename,encoding='UTF-8',mode='w+')for i in range(len(l...
2020-03-08 21:45:50 1549
原创 简单用python不经第三方包实现TF_IDF算法
from collections import defaultdictimport mathdef loadDataSet(): dataset = [ ['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], # 切分的词条 ['maybe', 'not', 'take',...
2020-03-08 18:25:45 256
原创 python map 键值对
states={ 'Oregon':'OR', 'Florida':'FL', 'California':'CA', 'New York':'NY', 'Michigan':'MI'}cities={ 'CA':'San Francisco', 'MI':'Detroit', 'FL':'Jacksonville'}cit...
2020-03-07 23:18:03 646
原创 python 逻辑术语
逻辑术语 在 python 中我们会用到下面的术语(字符或者词汇)来定义事物的真(True)或者假(False)。计算机的 逻辑就是在程序的某个位置检查这些字符或者变量组合在一起表达的结果是真是假。 • and 与 • or 或 • not 非 • != (not equal) 不等于 • == (equal) 等于 • >= (greater-than-eq...
2020-03-07 19:45:59 302
转载 NameError: name 'raw_input' is not defined
https://blog.csdn.net/hochean_/article/details/79582627
2020-03-07 17:40:36 109
python的学习PPT
2020-09-02
福州大学863数据结构ppt.zip
2020-01-10
如何用孪生网络进行图像分类(不是二分类,多标签分类)
2020-09-09
TA创建的收藏夹 TA关注的收藏夹
TA关注的人