You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.3 KiB
101 lines
2.3 KiB
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e34f22b5",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from IPython.display import Image\n",
|
|
"print(\"生成的图表:\")\n",
|
|
"\n",
|
|
"print(\"词云图:\")\n",
|
|
"display(Image(filename='visualization/wordcloud.png'))\n",
|
|
"\n",
|
|
"print(\"应用领域分布:\")\n",
|
|
"display(Image(filename='visualization/applications_distribution.png'))\n",
|
|
"\n",
|
|
"print(\"情感分析:\")\n",
|
|
"display(Image(filename='visualization/sentiment_analysis.png'))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "7756a032",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"print(\"生成可视化图表...\")\n",
|
|
"visualizer = Visualizer()\n",
|
|
"visualizer.create_comprehensive_visualization(processed_df, top_apps, word_freq)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "da2f2518",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"print(\"开始数据处理...\")\n",
|
|
"processor = DataProcessor()\n",
|
|
"processed_df, top_apps, word_freq = processor.main()\n",
|
|
"\n",
|
|
"# 显示处理结果\n",
|
|
"print(\"应用领域排名:\")\n",
|
|
"display(top_apps)\n",
|
|
"\n",
|
|
"print(\"\\n词频统计前10:\")\n",
|
|
"display(word_freq.head(10))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "db65ea20",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"print(\"开始数据爬取...\")\n",
|
|
"crawler = BilibiliDanmuCrawler()\n",
|
|
"raw_df = crawler.generate_mock_data()\n",
|
|
"print(f\"获取到 {len(raw_df)} 条弹幕数据\")\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "29015b15",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import sys\n",
|
|
"import os\n",
|
|
"sys.path.append('scripts')\n",
|
|
"\n",
|
|
"from crawler import BilibiliDanmuCrawler\n",
|
|
"from data_processor import DataProcessor\n",
|
|
"from visualizer import Visualizer\n",
|
|
"\n",
|
|
"import pandas as pd\n",
|
|
"import matplotlib.pyplot as plt"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "venv",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"name": "python",
|
|
"version": "3.13.9"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|