- AI源码解读:数字图像处理案例(Python版)
- 李永华编著
- 198字
- 2025-02-17 10:46:08
AI源码解读.数字图像处理案例:Python版
4.3.4 文本数据翻译与爬虫
本部分包括文本数据翻译和爬虫。
1.文本数据翻译
数据集中类别名称为英文,需要将其转换为中文,在翻译过程中使用百度翻译API。

2.爬虫
在实现输出狗狗百科和论坛网页的过程中,使用beautifulsoup和lxml的网络爬虫方法,将狗狗名称和对应的百科网站url、论坛网站url格式化存储在dogurls2.csv文件中,参考地址为http://www.boqii.com/pet-all/dog/?p=1。

通过Pandas库中函数data.head()查看dogurls2.csv前5行,信息输出如图4-5所示。

图4-5 dogurls2.csv文件前5行信息