Compare commits

...

7 Commits

Author SHA1 Message Date
2509165005
84fa4cc2d2 完成 q4_1 柱状图 2026-07-06 14:27:34 +08:00
2509165005
5e2b606039 完成 q4_3 评分+时长直方图 2026-07-06 14:22:03 +08:00
2509165005
1dd52409e7 完成 q4_3 评分+时长直方图 2026-07-06 14:19:45 +08:00
2509165005
d107481792 完成 q4_2 散点图 2026-07-06 14:12:49 +08:00
2509165005
d40ce14819 完成q4_1:电影类型柱状图,包含代码、数据和图片 2026-07-05 23:51:27 +08:00
2509165005
f4d9cb15dc 完成q3_3标注质量自评报告(200字) 2026-07-05 22:45:09 +08:00
2509165005
2bf94558d3 完成q3_3标注质量自评报告(200字) 2026-07-05 22:42:17 +08:00
13 changed files with 538 additions and 0 deletions

9
q3/q3_3_质量自评.md Normal file
View File

@@ -0,0 +1,9 @@
# 标注质量自评报告
## 一、标注前准备
标注前我制定了清晰的标注规范以文本核心情感倾向为判定依据“正面”标签适用于含正向评价如“配送快、味道好”的评论“负面”标签适用于含负面评价如“超时、口感差”的评论中性表述不影响核心情感判定。同时参考了8条已标注的外卖评论示例熟悉标签判定边界确保标注标准统一且可落地。
## 二、标注过程
标注中遇到的核心困难是部分评论存在情感混合表述如“配送慢但菜品新鲜”。我通过“核心诉求优先”原则解决聚焦用户主要评价点判定情感倾向对2条不确定的标注内容反复通读文本并标注关键评价词结合“是否有推荐/吐槽倾向”辅助判定,确保标注逻辑一致。
## 三、标注后检查
标注完成后我先逐行核对5条评论的id、text、sentiment字段完整性再将标注结果导出为JSON后重新导入系统对比前后数据无差异同时随机抽取3条评论二次标注两次结果完全一致确认标注无错误。

105
q4/q4_1/movies.json Normal file
View File

@@ -0,0 +1,105 @@
{
"data_code": "B-20260705-9162",
"movies": [
{
"id": 1,
"title": "放牛班的春天",
"director": "Frank Darabont",
"year": 2007,
"rating": 8.9,
"duration": 155,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 2,
"title": "霸王别姬",
"director": "陈凯歌",
"year": 2018,
"rating": 6.6,
"duration": 143,
"genre": "剧情",
"actors_count": 4
},
{
"id": 3,
"title": "星际穿越",
"director": "Robert Zemeckis",
"year": 2018,
"rating": 8.4,
"duration": 165,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 4,
"title": "肖申克的救赎",
"director": "James Cameron",
"year": 2008,
"rating": 8.6,
"duration": 124,
"genre": "剧情",
"actors_count": 5
},
{
"id": 5,
"title": "盗梦空间",
"director": "宫崎骏",
"year": 1993,
"rating": 7.8,
"duration": 90,
"genre": "爱情",
"actors_count": 2
},
{
"id": 6,
"title": "泰坦尼克号",
"director": "Christopher Nolan",
"year": 2001,
"rating": 6.7,
"duration": 175,
"genre": "喜剧",
"actors_count": 4
},
{
"id": 7,
"title": "忠犬八公的故事",
"director": "Lasse Hallström",
"year": 2004,
"rating": 8.2,
"duration": 91,
"genre": "动画",
"actors_count": 3
},
{
"id": 8,
"title": "三傻大闹宝莱坞",
"director": "Rajkumar Hirani",
"year": 2011,
"rating": 6.3,
"duration": 175,
"genre": "冒险",
"actors_count": 3
},
{
"id": 9,
"title": "阿甘正传",
"director": "Christophe Barratier",
"year": 2022,
"rating": 7.9,
"duration": 107,
"genre": "动画",
"actors_count": 4
},
{
"id": 10,
"title": "千与千寻",
"director": "Christopher Nolan",
"year": 1993,
"rating": 7.2,
"duration": 129,
"genre": "悬疑",
"actors_count": 3
}
]
}

30
q4/q4_1/q4_1.py Normal file
View File

@@ -0,0 +1,30 @@
# q4_1.py
import json
import matplotlib.pyplot as plt
from collections import Counter
# 读取上级目录的 movies.json
with open("../q4_2/movies.json", "r", encoding="utf-8") as f:
data = json.load(f)
movies = data["movies"]
# 统计每个类型有多少部电影
genres = [m["genre"] for m in movies]
genre_count = Counter(genres)
# X轴类型名称 Y轴数量
x = list(genre_count.keys())
y = list(genre_count.values())
# 绘制柱状图
plt.bar(x, y)
# 标题
plt.title("类型电影数量分布")
# 保存图片
plt.savefig("q4_1_bar.png", dpi=150)
plt.close()
print("✅ q4_1 柱状图完成!已生成 q4_1_bar.png")

BIN
q4/q4_1/q4_1_bar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

105
q4/q4_2/movies.json Normal file
View File

@@ -0,0 +1,105 @@
{
"data_code": "B-20260705-9162",
"movies": [
{
"id": 1,
"title": "放牛班的春天",
"director": "Frank Darabont",
"year": 2007,
"rating": 8.9,
"duration": 155,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 2,
"title": "霸王别姬",
"director": "陈凯歌",
"year": 2018,
"rating": 6.6,
"duration": 143,
"genre": "剧情",
"actors_count": 4
},
{
"id": 3,
"title": "星际穿越",
"director": "Robert Zemeckis",
"year": 2018,
"rating": 8.4,
"duration": 165,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 4,
"title": "肖申克的救赎",
"director": "James Cameron",
"year": 2008,
"rating": 8.6,
"duration": 124,
"genre": "剧情",
"actors_count": 5
},
{
"id": 5,
"title": "盗梦空间",
"director": "宫崎骏",
"year": 1993,
"rating": 7.8,
"duration": 90,
"genre": "爱情",
"actors_count": 2
},
{
"id": 6,
"title": "泰坦尼克号",
"director": "Christopher Nolan",
"year": 2001,
"rating": 6.7,
"duration": 175,
"genre": "喜剧",
"actors_count": 4
},
{
"id": 7,
"title": "忠犬八公的故事",
"director": "Lasse Hallström",
"year": 2004,
"rating": 8.2,
"duration": 91,
"genre": "动画",
"actors_count": 3
},
{
"id": 8,
"title": "三傻大闹宝莱坞",
"director": "Rajkumar Hirani",
"year": 2011,
"rating": 6.3,
"duration": 175,
"genre": "冒险",
"actors_count": 3
},
{
"id": 9,
"title": "阿甘正传",
"director": "Christophe Barratier",
"year": 2022,
"rating": 7.9,
"duration": 107,
"genre": "动画",
"actors_count": 4
},
{
"id": 10,
"title": "千与千寻",
"director": "Christopher Nolan",
"year": 1993,
"rating": 7.2,
"duration": 129,
"genre": "悬疑",
"actors_count": 3
}
]
}

33
q4/q4_2/q4_2.py Normal file
View File

@@ -0,0 +1,33 @@
# q4_2.py
import json
import matplotlib.pyplot as plt
# 1. 读取文件
with open("movies.json", "r", encoding="utf-8") as f:
data = json.load(f)
# 2. 安全提取电影列表
if type(data) is dict and "movies" in data:
movies = data["movies"]
else:
movies = []
# 3. 准备数据
x_data = []
y_data = []
for item in movies:
# 这一行彻底防止报错
if type(item) is dict:
x_data.append(item["duration"])
y_data.append(item["rating"])
# 4. 画图(题目全部要求)
plt.scatter(x_data, y_data, color="red", alpha=0.6)
plt.title("时长与评分关系散点图")
plt.xlabel("时长(分钟)")
plt.ylabel("评分")
plt.savefig("q4_2_scatter.png", dpi=150)
plt.close()
print("运行成功!")

BIN
q4/q4_2/q4_2_scatter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

105
q4/q4_3a/movies.json Normal file
View File

@@ -0,0 +1,105 @@
{
"data_code": "B-20260705-9162",
"movies": [
{
"id": 1,
"title": "放牛班的春天",
"director": "Frank Darabont",
"year": 2007,
"rating": 8.9,
"duration": 155,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 2,
"title": "霸王别姬",
"director": "陈凯歌",
"year": 2018,
"rating": 6.6,
"duration": 143,
"genre": "剧情",
"actors_count": 4
},
{
"id": 3,
"title": "星际穿越",
"director": "Robert Zemeckis",
"year": 2018,
"rating": 8.4,
"duration": 165,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 4,
"title": "肖申克的救赎",
"director": "James Cameron",
"year": 2008,
"rating": 8.6,
"duration": 124,
"genre": "剧情",
"actors_count": 5
},
{
"id": 5,
"title": "盗梦空间",
"director": "宫崎骏",
"year": 1993,
"rating": 7.8,
"duration": 90,
"genre": "爱情",
"actors_count": 2
},
{
"id": 6,
"title": "泰坦尼克号",
"director": "Christopher Nolan",
"year": 2001,
"rating": 6.7,
"duration": 175,
"genre": "喜剧",
"actors_count": 4
},
{
"id": 7,
"title": "忠犬八公的故事",
"director": "Lasse Hallström",
"year": 2004,
"rating": 8.2,
"duration": 91,
"genre": "动画",
"actors_count": 3
},
{
"id": 8,
"title": "三傻大闹宝莱坞",
"director": "Rajkumar Hirani",
"year": 2011,
"rating": 6.3,
"duration": 175,
"genre": "冒险",
"actors_count": 3
},
{
"id": 9,
"title": "阿甘正传",
"director": "Christophe Barratier",
"year": 2022,
"rating": 7.9,
"duration": 107,
"genre": "动画",
"actors_count": 4
},
{
"id": 10,
"title": "千与千寻",
"director": "Christopher Nolan",
"year": 1993,
"rating": 7.2,
"duration": 129,
"genre": "悬疑",
"actors_count": 3
}
]
}

25
q4/q4_3a/q4_3a.py Normal file
View File

@@ -0,0 +1,25 @@
# q4_3a.py
import json
import matplotlib.pyplot as plt
# 读取数据
with open("movies.json", "r", encoding="utf-8") as f:
data = json.load(f)
movies = data["movies"]
# 提取评分
ratings = []
for m in movies:
ratings.append(m["rating"])
# 绘制直方图
plt.hist(ratings, bins=5, color="blue")
plt.title("评分分布")
plt.xlabel("评分")
# 保存图片
plt.savefig("q4_3a_hist.png", dpi=150)
plt.close()
print("✅ q4_3a 完成!")

BIN
q4/q4_3a/q4_3a_hist.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

105
q4/q4_3b/movies.json Normal file
View File

@@ -0,0 +1,105 @@
{
"data_code": "B-20260705-9162",
"movies": [
{
"id": 1,
"title": "放牛班的春天",
"director": "Frank Darabont",
"year": 2007,
"rating": 8.9,
"duration": 155,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 2,
"title": "霸王别姬",
"director": "陈凯歌",
"year": 2018,
"rating": 6.6,
"duration": 143,
"genre": "剧情",
"actors_count": 4
},
{
"id": 3,
"title": "星际穿越",
"director": "Robert Zemeckis",
"year": 2018,
"rating": 8.4,
"duration": 165,
"genre": "悬疑",
"actors_count": 5
},
{
"id": 4,
"title": "肖申克的救赎",
"director": "James Cameron",
"year": 2008,
"rating": 8.6,
"duration": 124,
"genre": "剧情",
"actors_count": 5
},
{
"id": 5,
"title": "盗梦空间",
"director": "宫崎骏",
"year": 1993,
"rating": 7.8,
"duration": 90,
"genre": "爱情",
"actors_count": 2
},
{
"id": 6,
"title": "泰坦尼克号",
"director": "Christopher Nolan",
"year": 2001,
"rating": 6.7,
"duration": 175,
"genre": "喜剧",
"actors_count": 4
},
{
"id": 7,
"title": "忠犬八公的故事",
"director": "Lasse Hallström",
"year": 2004,
"rating": 8.2,
"duration": 91,
"genre": "动画",
"actors_count": 3
},
{
"id": 8,
"title": "三傻大闹宝莱坞",
"director": "Rajkumar Hirani",
"year": 2011,
"rating": 6.3,
"duration": 175,
"genre": "冒险",
"actors_count": 3
},
{
"id": 9,
"title": "阿甘正传",
"director": "Christophe Barratier",
"year": 2022,
"rating": 7.9,
"duration": 107,
"genre": "动画",
"actors_count": 4
},
{
"id": 10,
"title": "千与千寻",
"director": "Christopher Nolan",
"year": 1993,
"rating": 7.2,
"duration": 129,
"genre": "悬疑",
"actors_count": 3
}
]
}

21
q4/q4_3b/q4_3b.py Normal file
View File

@@ -0,0 +1,21 @@
# q4_3b.py
import json
import matplotlib.pyplot as plt
with open("../q4_2/movies.json", "r", encoding="utf-8") as f:
data = json.load(f)
movies = data["movies"]
durations = []
for m in movies:
durations.append(m["duration"])
plt.hist(durations, bins=5, color="green")
plt.title("时长分布")
plt.xlabel("时长(分钟)")
plt.savefig("q4_3b_hist.png", dpi=150)
plt.close()
print("✅ 时长直方图生成成功!")

BIN
q4/q4_3b/q4_3b_hist.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB