当前位置: 首页 > news >正文

深圳优化网站公司哪家好成都外贸seo

深圳优化网站公司哪家好,成都外贸seo,怎样建网站步骤,资源网站平台建设方案有一个Excel中的一列#xff0c;读取文本判断文本包含积极情感词.txt和消极情感词.txt的个数#xff0c;分别生成两列统计数据 请将 ‘your_file.xlsx’ 替换为你的Excel文件名#xff0c;Your Text Column’替换为包含文本的列名。 这个程序首先读取了积极和消极情感词读取文本判断文本包含积极情感词.txt和消极情感词.txt的个数分别生成两列统计数据 请将 ‘your_file.xlsx’ 替换为你的Excel文件名Your Text Column’替换为包含文本的列名。 这个程序首先读取了积极和消极情感词并定义了两个函数来统计文本中这些词的数量。然后它使用这两个函数来创建新的列并将结果保存为一个新的Excel文件。 # -*- coding:utf-8 -*-f import pandas as pd# 读入数据# 读取Excel文件 file_path chatGPT_analyse_result.xlsx df pd.read_excel(file_path)# 定义函数来统计文本中出现的词汇数 def count_words(text, word_list):count 0for word in word_list:if word in text:count 1return count# 读取积极和消极情绪词文件 positive_words_path 积极情绪词库.txt # 请替换为你的积极情绪词文件路径 negative_words_path 消极情绪词库.txt # 请替换为你的消极情绪词文件路径# 读取积极和消极情绪词文件内容到列表中 with open(positive_words_path, r, encodingutf-8) as file:positive_words [line.strip() for line in file]with open(negative_words_path, r, encodingutf-8) as file:negative_words [line.strip() for line in file]# 对每一行文本进行积极和消极情绪词的统计 positive_counts [] negative_counts []for text in df[分析结果]:positive_count count_words(str(text), positive_words)negative_count count_words(str(text), negative_words)positive_counts.append(positive_count)negative_counts.append(negative_count)# 将统计结果添加到数据框中 df[积极情绪词个数] positive_counts df[消极情绪词个数] negative_counts# 将结果保存到新的Excel文件中 output_file_path 分析结果.xlsx df.to_excel(output_file_path, indexFalse)print(已生成带有情绪词统计的Excel文件。) 发现次数都是0 调整prompt 还是不匹配 接续追问 成功解决bug出现了分析结果 最后代码 # -*- coding:utf-8 -*-f import pandas as pd import jieba # 读入数据# 读取Excel文件 file_path chatGPT_analyse_result.xlsx df pd.read_excel(file_path)# 情绪词列表 positive_words [透露, 亲切, 容忍, 听从, 被动, 创新, 发表, 好的, 鼓舞, 赋予, 喜欢, 配合, 聪明, 偏向, 交流, 合理, 猜测, 夸奖, 致力于, 称赞, 不错, 听懂, 安慰, 善于, 爱, 提升, 坚持, 看好, 指引, 劝慰, 舒缓, 减轻, 推导, 愉快, 轻松, 沟通, 有序, 进步, 谢谢, 强烈, 懂, 恰当, 持之以恒, 至关重要, 振奋, 赞成, 妥当, 礼貌, 温暖, 有利于]negative_words [批评, 不对, 抱歉, 薄弱, 不适, 不足, 谴责, 逼迫, 厌烦, 不行, 指责, 负面, 惩罚, 紧张, 责备, 告诫, 挫败, 气馁, 紧迫, 质疑, 不满, 贬低, 忽视, 批判, 疑惑, 反对, 不是, 失败, 催促, 担心, 无礼, 失去, 焦虑, 着急, 退步, 模糊, 放弃, 迷惘, 灰心丧气, 批判性, 禁止, 不当, 犯错, 忽略, 拒绝, 担忧, 不专业, 困难]# 分词函数 def tokenize(text):return jieba.lcut(text)# 对每一行文本进行分词和积极、消极情绪词的统计 positive_counts [] negative_counts []for text in df[分析结果]:words tokenize(str(text)) # 分词positive_count any(word in positive_words for word in words)negative_count any(word in negative_words for word in words)positive_counts.append(1 if positive_count else 0)negative_counts.append(1 if negative_count else 0)# 将统计结果添加到数据框中 df[积极情绪词个数] positive_counts df[消极情绪词个数] negative_counts# 将结果保存到新的Excel文件中 output_file_path 分析结果.xlsx df.to_excel(output_file_path, indexFalse)print(已生成带有情绪词统计的Excel文件。)最后在画个图 转换成分钟 import pandas as pd# 读取Excel文件 file_path chatGPT_analyse_result.xlsx # 请替换为你的Excel文件路径 df pd.read_excel(file_path)# 提取时间列中的分钟和秒钟数据 time_pattern r(\d):(\d) df[分钟] df[时间].str.extract(time_pattern)[0].astype(int) * 60 # 提取分钟并转换为秒钟 df[秒钟] df[时间].str.extract(time_pattern)[1].astype(int)# 计算总的秒钟数 df[总秒钟数] df[分钟] df[秒钟]# 将总秒钟数转换回分钟 df[总分钟数] df[总秒钟数] / 60# 打印结果或保存到新的Excel文件中 print(df[[分钟, 秒钟, 总秒钟数, 总分钟数]]) # 打印结果 # 或者保存到新的Excel文件中 output_file_path 处理后的结果.xlsxdf.to_excel(output_file_path, indexFalse) print(ok)import pandas as pd import matplotlib.pyplot as plt plt.rcParams[font.sans-serif][SimHei] plt.rcParams[axes.unicode_minus]False# 读取Excel文件 file_path 分析结果.xlsx # 请替换为你的Excel文件路径 df pd.read_excel(file_path)# 映射积极情绪词个数和消极情绪词个数到1和-1 df[积极情绪映射] df[积极情绪词个数].apply(lambda x: 1) df[消极情绪映射] df[消极情绪词个数].apply(lambda x: -1)# 绘制折线图 plt.figure(figsize(10, 6)) # 设置图形大小# 以总分钟数为 x 轴积极情绪映射和消极情绪映射为 y 轴绘制折线图 plt.plot(df[总分钟数], df[积极情绪映射], label积极情绪词个数, markero) # markero 表示使用圆点标记数据点 plt.plot(df[总分钟数], df[消极情绪映射], label消极情绪词个数, markerx) # markerx 表示使用X标记数据点plt.xlabel(总分钟数) # x 轴标签 plt.ylabel(情绪) # y 轴标签 plt.title(课堂时间与情绪变化折线图) # 图表标题plt.legend() # 显示图例 plt.grid(True) # 显示网格线plt.ylim(-1.5, 1.5) # 设置 y 轴显示范围plt.tight_layout() # 调整布局使标签等不会被裁剪 plt.show() # 显示图形 结果如图
http://www.w-s-a.com/news/349650/

相关文章:

  • 网站建设一般是用哪个软件刚开始做写手上什么网站
  • 用jsp做的网站源代码下载有哪些做红色旅游景点的网站
  • 网站开发的技术选型黄石市网站建设
  • 做直播网站需要证书吗专做宝宝的用品网站
  • 网站标题用什么符号网站制作交易流程
  • dede模板网站教程jsp网站搭建
  • 上海网站开发外包公司鲜花导购网页制作
  • 宿州外贸网站建设公司个人注册网站一般做什么
  • 小公司做网站用哪种服务器什么是网站代理
  • 青岛李村网站设计公司cms建站平台
  • 做saas网站可行吗许昌抖音推广公司
  • 网站建设找谁做seo基础知识培训
  • 微网站怎么做的好建设网站不会写代码
  • 广州外贸网站制作wordpress信息搜索插件
  • 福建高端网站建设个人公众号怎么制作教程
  • 企业网站有哪些举几个例子wordpress ie兼容插件
  • 高端的深圳网站页面设计福清市建设局官方网站
  • 安装网站到服务器合肥建设干部学校网站
  • 影视网站如何做销售案例网站
  • 建设网站对比方案龙岗网站开发公司
  • 网站开发标准网站建设公司兴田德润可信赖
  • 如何建设一个公众号电影网站自动seo优化
  • 个人网站能备案吗酱香拿铁采取了哪些网络营销方式
  • 网站建设及推广好做吗自己做的网站加入购物车价格
  • 涡阳在北京做网站的名人注册一个免费的网站
  • 三门峡建设环境局网站公司注册网上核名通道
  • 叶县建设局网站要看网海外域名是多少
  • 网站运行环境配置Wordpress支付时效
  • logo设计网站知乎港北网站建设
  • 北京市保障性住房建设投资中心官方网站有限责任公司的特点