赞
踩
在做文本分析之前,一般我们都需要进行文本的预处理。这一步其实和做数据时的数据清洗非常的相像。在对文本进行清洗的时候,我们需要分成中文和英文两种语言来进行,因为语言的不同,我们需要进行的操作也不同:
下面我们分开来记述操作!~
python包:nltk+string
text = 'Natural language processing (NLP) Is A SuBfield Of Computer scIence, inFormation eNgineering, and artificial intelligence concerned with the interactions between computers and human (natural) languages, in particular how to program computers to process and analyze large amounts of natural language data!?!!....'
以上文本选自wikipedia的nlp介绍,为了测试效果,我自己把小写改成了大写,添加了几个标点。
操作过程一般都是大写字母转换成小写字母,毕竟表示的是一个意思。
#转换成小写
lower = text.lower
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。