04 2020 档案

摘要:1. 问题发现: 出现:读取文件,对其进行解码,出现错误,AttributeError: 'str' object has no attribute 'decode' 解释:属性错误,str对象不包含‘decode’属性。 2.原因解释: 出现问题原因:str与bytes表示的是两种数据类型,str 阅读全文
posted @ 2020-04-27 12:22 大明王 阅读(75829) 评论(0) 推荐(1)
摘要:1、pyltp简介 pyltp 是哈工大自然语言工作组推出的一款基于Python 封装的自然语言处理工具(轮子),提供了分词,词性标注,命名实体识别,依存句法分析,语义角色标注的功能。 2、pyltp安装方法 安装环境:windows10,python3.6 2.1.安装pyltp库 安装方法一:使 阅读全文
posted @ 2020-04-27 12:11 大明王 阅读(20989) 评论(2) 推荐(2)
摘要:stanfordcorenlp安装教程&简单使用教程 编译环境:python 3.6 、win10 64位、jdk1.8及以上 1、stanfordcorenlp安装依赖环境 下载安装JDK 1.8及以上版本。安装教程:https://blog.csdn.net/qq_40426415/articl 阅读全文
posted @ 2020-04-11 20:21 大明王 阅读(4444) 评论(1) 推荐(0)
摘要:1、问题描述 安装stanfordcorenlp成功,import stanfordcorenlp失败,pycharm中输入import stanfordcorenlp,然后运行,出现错误:importerror-no-module-named-psutil 2、解决方法: 切换psutil的版本, 阅读全文
posted @ 2020-04-11 16:40 大明王 阅读(1835) 评论(0) 推荐(0)
摘要:1、问题描述: pyhanlp成功安装,并且可以正常使用,但是这段时间再去用的时候,发现出问题了,一运行就出现,下面的问题: importerror: cannot import name 'jvmnotfoundexception' 2、原因解释: 因为我胡乱升级了jpype1的版本,造成pyha 阅读全文
posted @ 2020-04-11 16:25 大明王 阅读(1766) 评论(0) 推荐(0)
摘要:1、目标网站 目标网站:https://so.gushiwen.org/shiwen/default.aspx? 2、爬虫目的 爬取目标网站的文本,如古诗的内容,作者,朝代,并且保存到本地中。 3、爬虫程序 # -*- coding:utf-8 -*- #爬取古诗网站 import requests 阅读全文
posted @ 2020-04-09 19:21 大明王 阅读(2884) 评论(0) 推荐(0)
摘要:1、目的 爬取笔趣阁网站的剑来小说正文内容,并保存到本地中。 2、实现方案 首先,请求目标网站的网页数据,通过分析找出章节地址的特点,并通过xpath获取到章节链接; 其次,请求每一章节的内容,通过数据清洗去除脏数据,得到剑来文章正文; 最后,保存数据到本地。 3、程序设计 3.1 请求数据模块 请 阅读全文
posted @ 2020-04-04 13:04 大明王 阅读(1029) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import requests from lxml import etree class BookSpider(object): def __init__(self): self.url = "http://www.jianlaixiaoshuo.co 阅读全文
posted @ 2020-04-04 11:53 大明王 阅读(711) 评论(0) 推荐(0)
摘要:续上篇:https://www.cnblogs.com/maxxu11/p/12626007.html 1、代码: # -*- coding: utf-8 -*- import requests from lxml import etree import os from urllib import 阅读全文
posted @ 2020-04-03 20:26 大明王 阅读(339) 评论(0) 推荐(0)