Python
席八
欢迎光临
展开
-
Python自然语言处理笔记(五)wordnet意义与同义词
>>> wn.synsets('computer')[Synset('computer.n.01'), Synset('calculator.n.01')]>>> wn.synset('computer.n.01').lemmas<bound method Synset.lemmas of Synset('computer.n.01')>&g...原创 2020-12-19 14:46:26 · 427 阅读 · 0 评论 -
Numpy学习笔记
numpy.zeros创建指定大小的数组,数组元素以 0 来填充:numpy.zeros(shape, dtype = float, order = ‘C’)参数说明:参数 描述shape 数组形状dtype 数据类型,可选order ‘C’ 用于 C 的行数组,或者 ‘F’ 用于 FORTRAN 的列数组实例import numpy as np#默认为浮点数x = np.zeros(5)print(x)#设置类型为整数y = np.zeros((5,), dtype = np.原创 2020-10-26 22:45:35 · 120 阅读 · 0 评论 -
Python自然语言处理笔记(四)wordnet可视化
networkx书中代码实现书中p165,networkx和matplotlib结合使用可视化wordnet的网络结构(语义网络)import networkx as nximport matplotlibfrom nltk.corpus import wordnet as wn def traverse(graph, start, node): graph.depth[no...原创 2020-04-28 10:45:25 · 919 阅读 · 0 评论 -
Python自然语言处理笔记(三)wordnet层次结构
上位词集hypernyms()#查看上位词motorcar.hypernyms()paths=motorcar.hypernym_paths() #motorcar的词汇路径,所有的上位词最低共同上位词集lowesr_common_hypernyms()right.lowest_common_hypernyms(minke) #查找right与minke的共同上位词根上位...原创 2020-04-26 13:10:41 · 798 阅读 · 0 评论 -
Python自然语言处理笔记(二)nltk实践记录
nltk的安装install nltknltk.download()报错[nltk_data] Error loading wordnet: <urlopen error [Errno 11004] [nltk_data] getaddrinfo failed>nltk.download()报错getaddrinfo failed参考解决NLTK语料库下载出错及n...原创 2020-04-25 14:21:47 · 1579 阅读 · 2 评论 -
Python学习笔记:为什么0.2+0.1不等于0.3
在python程序中发现的问题,三个0.2相加之和显示出来的却是0.60000000000001。计算机中数据以0和1存储,浮点数并不能准确地表示十进制。并且,即便是最简单的数学运算,也会带来不可控制的后果。而print函数也会舍去精度范围外的尾数(也不精确)。总结:为什么0.1 + 0.2 不等于0.3。因为计算机不能精确表示0.1, 0.2这样的浮点数,计算时使用的是带有舍入误差的数...原创 2020-04-25 02:06:58 · 6901 阅读 · 0 评论 -
Python自然语言处理笔记(一)wordnet相似度计算
nltk的安装install nltknltk.download()报错[nltk_data] Error loading wordnet: <urlopen error [Errno 11004] [nltk_data] getaddrinfo failed>nltk.download()报错getaddrinfo failed参考解决NLTK语料库下载出错及n...原创 2020-04-24 16:02:07 · 3636 阅读 · 3 评论