《Natural Language Processing with Python》读书笔记 004期

编程是切勿急躁,但是也不能慢悠悠啊【手动捂脸】

这章主要都是python的非常基础的知识,有很多BUG也都是非常非常有特点的需要注意的

基本上对于个人来讲没有特别多的新知识了

assert的用法可以再熟悉一下,这个其实有的时候挺有用的,尤其是在学网课进行自我监督时。

函数的docstring突然想起来,自己貌似很少写╮(╯▽╰)╭,这点之后也得注意

引用一段话:

编程是一种技能,需要获得几年的各种编程语言和任务的经验。关键的高层次能力是算法设计及其在结构化编程中的实现。关键的低层次的能力包括熟悉语言的语法结构,以及排除故障的程序(不能表现预期的行为的程序)的各种诊断方法的知识。

pdb这个调试器不怎么用,通常都是用print。


关于NetworkX,这个之前也没有用过,所以上来也是遇到了

AttributeError: module 'networkx' has no attribute 'draw_graphviz'

这个错误,然后参考了网页:
http://python.thenaiveapproach.com/buggy-module-installation-networkx-pygraphviz/
http://www.bubblefertilizer.com/graphviz-pydot-pygraphviz-networkx-matplotlib-phylo-tree.html
个人电脑室win10系统,所以去官网下载windows的.msi文件:https://graphviz.gitlab.io/_pages/Download/Download_windows.html
安装简介参照:https://blog.csdn.net/lanchunhui/article/details/49472949
然后就是pygraphviz这个库的安装了,这个就非常的麻烦了,我们都知道如果看见microsoft visual c++ 14.0 is required的报错,尽量都是避免安装这个控件,而是直接去: https://www.lfd.uci.edu/~gohlke/pythonlibs寻找对应python的对应whl,但是pygraphviz真的目前只支持到python3.4,这也是很有趣,为什么NLTK官网是以python3.4为主题……于是问题就变得麻烦了,目前肯定是还没有继续安装Microsoft Visual Studio的打算。
赶紧继续查了一下版本问题,目前可以直接看到draw_graphviz函数存在是因为网上目前使用的NetworkX版本为1.11.0或者1.10.0,所以这个就很奇妙了,然后去2.0的官网看了一下https://networkx.github.io/documentation/stable/release/release_2.0,赫然写着:

Remove draw_graphviz function. Fixes #1997 (#2077)

我……emmm,手动微笑
于是,去stackoverflow重新搜索了问题:https://stackoverflow.com/questions/41047362/python-networkx-error-module-networkx-drawing-has-no-attribute-graphviz-layo
终于解决,只要直接用draw这个函数就好了,不用管其他的。

真是的……不明所以,这个也算是吃了一次教训,因为版本的原因,我应该在这种函数普通搜索没有结果之前,先去到官网doc里面寻找一遍,然后再重新搜索问题。希望本文章能够帮到足够多的人,不再受到网上过时代码的影响。

程序这种东西发展速度真得是很快,完全没有预料到会有这么多issue,也是感慨一番。前些日子看到有人说程序员比常人的优势之一在于:能够更快、高效地使用搜索引擎掌握解决BUG的方法。果然是经验之谈,而且非常有道理,修行还将继续。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Python Natural Language Processing by Jalaj Thanaki English | 31 July 2017 | ISBN: 1787121429 | ASIN: B072B8YWCJ | 486 Pages | AZW3 | 11.02 MB Key Features Implement Machine Learning and Deep Learning techniques for efficient natural language processing Get started with NLTK and implement NLP in your applications with ease Understand and interpret human languages with the power of text analysis via Python Book Description This book starts off by laying the foundation for Natural Language Processing and why Python is one of the best options to build an NLP-based expert system with advantages such as Community support, availability of frameworks and so on. Later it gives you a better understanding of available free forms of corpus and different types of dataset. After this, you will know how to choose a dataset for natural language processing applications and find the right NLP techniques to process sentences in datasets and understand their structure. You will also learn how to tokenize different parts of sentences and ways to analyze them. During the course of the book, you will explore the semantic as well as syntactic analysis of text. You will understand how to solve various ambiguities in processing human language and will come across various scenarios while performing text analysis. You will learn the very basics of getting the environment ready for natural language processing, move on to the initial setup, and then quickly understand sentences and language parts. You will learn the power of Machine Learning and Deep Learning to extract information from text data. By the end of the book, you will have a clear understanding of natural language processing and will have worked on multiple examples that implement NLP in the real world. What you will learn Focus on Python programming paradigms, which are used to develop NLP applications Understand corpus analysis and different types of data attribute. Learn NLP using Python libraries such as NLTK, Polyglot,
以下是《Natural Language Processing with Python》一书中前 100 个出现频率最高的单词及其出现次数: | 单词 | 出现次数 | | --- | --- | | the | 2360 | | , | 2197 | | . | 1974 | | of | 1254 | | and | 1075 | | to | 1052 | | a | 1024 | | in | 820 | | 's | 741 | | that | 622 | | for | 439 | | is | 416 | | we | 392 | | with | 387 | | The | 374 | | it | 352 | | as | 345 | | on | 332 | | this | 331 | | be | 326 | | are | 321 | | by | 304 | | from | 301 | | can | 298 | | our | 291 | | an | 284 | | or | 266 | | language | 256 | | NLP | 240 | | at | 237 | | natural | 215 | | processing | 202 | | not | 201 | | but | 199 | | have | 196 | | will | 186 | | text | 182 | | all | 180 | | their | 179 | | has | 178 | | one | 178 | | used | 177 | | more | 174 | | by-nc-nd | 172 | | using | 170 | | about | 166 | | can't | 166 | | or-nc-nd | 165 | | its | 165 | | they | 165 | | other | 164 | | than | 164 | | some | 163 | | which | 160 | | also | 159 | | than-nc | 154 | | than-nc-nd | 153 | | may | 151 | | would | 151 | | these | 143 | | such | 142 | | there | 139 | | new | 136 | | when | 134 | | into | 133 | | been | 128 | | two | 127 | | many | 124 | | most | 124 | | using-nc-nd | 123 | | first | 121 | | up | 120 | | should | 118 | | out | 116 | | between | 115 | | also-nc-nd | 114 | | them | 114 | | do | 113 | | using-nc | 112 | | only | 111 | | time | 111 | | been-nc-nd | 110 | | if | 109 | | like | 109 | | because | 108 | | used-nc-nd | 108 | | which-nc-nd | 108 | | so | 107 | | each | 106 | | two-nc-nd | 104 | | were | 103 | 可以看出,这份数据中出现次数最多的单词都是一些常见的英文单词,比如“the”、“and”、“a”、“in”等等。同时,也有一些和本书主题相关的单词,比如“NLP”、“natural”、“processing”和“text”等等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值