-
Notifications
You must be signed in to change notification settings - Fork 7
Description
仅使用词云
(coolqbot-py3.10) @he0119 ➜ /workspaces/CoolQBot (master) $ python -m memory_profiler bot.py 01-30 02:09:07 [SUCCESS] nonebot | NoneBot is initializing... 01-30 02:09:07 [INFO] nonebot | Current Env: prod 01-30 02:09:09 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_apscheduler" 01-30 02:09:10 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_localstore" 01-30 02:09:10 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_datastore" 01-30 02:09:10 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_chatrecorder" 01-30 02:09:13 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_wordcloud" 01-30 02:09:13 [WARNING] __main__ | Always use `nb run` to start the bot instead of manually running! 01-30 02:09:13 [SUCCESS] nonebot | Running NoneBot... 01-30 02:09:13 [INFO] uvicorn | Started server process [22783] 01-30 02:09:13 [INFO] uvicorn | Waiting for application startup. 01-30 02:09:13 [INFO] nonebot_plugin_apscheduler | Scheduler Started 01-30 02:09:13 [INFO] nonebot_plugin_datastore | 数据库初始化完成 01-30 02:09:13 [INFO] uvicorn | Application startup complete. 01-30 02:09:13 [INFO] uvicorn | Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit) 01-30 02:09:16 [INFO] uvicorn | ('127.0.0.1', 35506) - "WebSocket /onebot/v11/" [accepted] 01-30 02:09:16 [INFO] nonebot | OneBot V11 | Bot 28******70 connected 01-30 02:09:16 [INFO] websockets | connection open 01-30 02:09:18 [SUCCESS] nonebot | OneBot V11 28******70 | [message.group.normal]: Message -1522094400 from 417****20@[群:764****76] "/今日词云" 01-30 02:09:18 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud) Building prefix dict from the default dictionary ... Loading model from cache /tmp/jieba.cache Loading model cost 1.318 seconds. Prefix dict has been built successfully. Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 203.4 MiB 203.4 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 203.4 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 203.4 MiB 0.0 MiB 43 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 205.0 MiB 1.6 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 281.2 MiB 76.2 MiB 1 frequency = analyse_message(message)
69 281.2 MiB 0.0 MiB 1 try:
70 288.2 MiB 7.0 MiB 2 wordcloud = WordCloud(
71 281.2 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 281.2 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 281.2 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 281.2 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 281.2 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 281.2 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 342.6 MiB 54.4 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 342.6 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 342.8 MiB 0.3 MiB 1 image.save(image_bytes, format="PNG")
81 342.8 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:09:28 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:09:32 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message 1123976135 from 41720@[群:764**76] "/今日词云"
01-30 02:09:32 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 343.2 MiB 343.2 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 343.2 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 343.2 MiB 0.0 MiB 44 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 343.2 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 343.2 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 343.2 MiB 0.0 MiB 1 try:
70 343.2 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 343.2 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 343.2 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 343.2 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 343.2 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 343.2 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 343.2 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 343.5 MiB 0.3 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 343.5 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 343.5 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 343.5 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:09:39 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:09:42 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message -1675240821 from 41720@[群:764**76] "/今日词云"
01-30 02:09:42 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 343.5 MiB 343.5 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 343.5 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 343.5 MiB 0.0 MiB 45 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 343.5 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 343.5 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 343.5 MiB 0.0 MiB 1 try:
70 343.5 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 343.5 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 343.5 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 343.5 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 343.5 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 343.5 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 343.5 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 355.5 MiB 12.0 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 355.5 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 355.5 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 355.5 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:09:49 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:09:50 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message 1915468711 from 41720@[群:764**76] "/今日词云"
01-30 02:09:50 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 355.5 MiB 355.5 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 355.5 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 355.5 MiB 0.0 MiB 46 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 355.5 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 355.5 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 355.5 MiB 0.0 MiB 1 try:
70 355.5 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 355.5 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 355.5 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 355.5 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 355.5 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 355.5 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 355.5 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 358.3 MiB 2.8 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 358.3 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 358.3 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 358.3 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:09:57 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:10:06 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message -1689772398 from 41720@[群:764**76] "/今日词云"
01-30 02:10:06 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 355.4 MiB 355.4 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 355.4 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 355.4 MiB 0.0 MiB 47 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 355.4 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 355.4 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 355.4 MiB 0.0 MiB 1 try:
70 355.4 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 355.4 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 355.4 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 355.4 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 355.4 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 355.4 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 355.4 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 355.7 MiB 0.4 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 355.7 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 355.7 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 355.7 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:10:12 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:10:19 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message 1967554494 from 41720@[群:764**76] "/今日词云"
01-30 02:10:19 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 355.7 MiB 355.7 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 355.7 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 355.7 MiB 0.0 MiB 48 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 355.7 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 355.7 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 355.7 MiB 0.0 MiB 1 try:
70 355.7 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 355.7 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 355.7 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 355.7 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 355.7 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 355.7 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 355.7 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 355.7 MiB -0.0 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 355.7 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 355.7 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 355.7 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass
01-30 02:10:25 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
与 petpet 一起使用
(coolqbot-py3.10) @he0119 ➜ /workspaces/CoolQBot (master) $ python -m memory_profiler bot.py 01-30 02:07:46 [SUCCESS] nonebot | NoneBot is initializing... 01-30 02:07:46 [INFO] nonebot | Current Env: prod 01-30 02:07:53 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_imageutils" 01-30 02:07:57 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_petpet" 01-30 02:07:57 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_apscheduler" 01-30 02:07:58 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_localstore" 01-30 02:07:59 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_datastore" 01-30 02:07:59 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_chatrecorder" 01-30 02:08:01 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_wordcloud" 01-30 02:08:01 [WARNING] __main__ | Always use `nb run` to start the bot instead of manually running! 01-30 02:08:01 [SUCCESS] nonebot | Running NoneBot... 01-30 02:08:02 [INFO] uvicorn | Started server process [21989] 01-30 02:08:02 [INFO] uvicorn | Waiting for application startup. 01-30 02:08:02 [INFO] nonebot_plugin_petpet | 正在检查资源文件... 01-30 02:08:02 [INFO] nonebot_plugin_apscheduler | Scheduler Started 01-30 02:08:02 [INFO] nonebot_plugin_datastore | 数据库初始化完成 01-30 02:08:02 [INFO] uvicorn | Application startup complete. 01-30 02:08:02 [INFO] uvicorn | Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit) 01-30 02:08:06 [INFO] uvicorn | ('127.0.0.1', 55988) - "WebSocket /onebot/v11/" [accepted] 01-30 02:08:06 [INFO] nonebot | OneBot V11 | Bot 28******70 connected 01-30 02:08:06 [INFO] websockets | connection open 01-30 02:08:07 [SUCCESS] nonebot | OneBot V11 28******70 | [message.group.normal]: Message 1541780102 from 417****20@[群:764****76] "/今日词云" 01-30 02:08:07 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud) Building prefix dict from the default dictionary ... Loading model from cache /tmp/jieba.cache Loading model cost 0.708 seconds. Prefix dict has been built successfully. Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 230.2 MiB 230.2 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 230.2 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 230.2 MiB 0.0 MiB 39 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 231.8 MiB 1.5 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 308.4 MiB 76.6 MiB 1 frequency = analyse_message(message)
69 308.4 MiB 0.0 MiB 1 try:
70 314.8 MiB 6.5 MiB 2 wordcloud = WordCloud(
71 308.4 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 308.4 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 308.4 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 308.4 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 308.4 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 308.4 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 369.9 MiB 55.1 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 369.9 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 370.2 MiB 0.3 MiB 1 image.save(image_bytes, format="PNG")
81 370.2 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:08:18 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:08:22 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message 1277496309 from 41720@[群:764**76] "/今日词云"
01-30 02:08:22 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 342.3 MiB 342.3 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 342.3 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 342.3 MiB 0.0 MiB 40 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 342.3 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 342.3 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 342.3 MiB 0.0 MiB 1 try:
70 342.3 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 342.3 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 342.3 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 342.3 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 342.3 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 342.3 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 342.3 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 403.3 MiB 61.1 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 403.3 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 403.3 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 403.3 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:08:29 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:08:38 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message -1574212903 from 41720@[群:764**76] "/今日词云"
01-30 02:08:38 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 403.3 MiB 403.3 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 403.3 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 403.3 MiB 0.0 MiB 41 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 403.3 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 403.3 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 403.3 MiB 0.0 MiB 1 try:
70 403.3 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 403.3 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 403.3 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 403.3 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 403.3 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 403.3 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 403.3 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 463.5 MiB 60.2 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 463.5 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 463.5 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 463.5 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass01-30 02:08:43 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete
01-30 02:08:48 [SUCCESS] nonebot | OneBot V11 2870 | [message.group.normal]: Message 1263063020 from 41720@[群:764**76] "/今日词云"
01-30 02:08:48 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_wordcloud)
Filename: /home/codespace/.cache/pypoetry/virtualenvs/coolqbot-GLv7R7ai-py3.10/lib/python3.10/site-packages/nonebot_plugin_wordcloud/data_source.pyLine # Mem usage Increment Occurrences Line Contents
57 461.9 MiB 461.9 MiB 1 @run_sync
58 @profile
59 def get_wordcloud(
60 messages: List[str], mask_key: Optional[str] = None
61 ) -> Optional[BytesIO]:
62 # 过滤掉命令
63 461.9 MiB 0.0 MiB 5 command_start = tuple([i for i in global_config.command_start if i])
64 461.9 MiB 0.0 MiB 42 message = " ".join([m for m in messages if not m.startswith(command_start)])
65 # 预处理
66 461.9 MiB 0.0 MiB 1 message = pre_precess(message)
67 # 分析消息。分词,并统计词频
68 461.9 MiB 0.0 MiB 1 frequency = analyse_message(message)
69 461.9 MiB 0.0 MiB 1 try:
70 461.9 MiB 0.0 MiB 2 wordcloud = WordCloud(
71 461.9 MiB 0.0 MiB 1 font_path=str(plugin_config.wordcloud_font_path),
72 461.9 MiB 0.0 MiB 1 width=plugin_config.wordcloud_width,
73 461.9 MiB 0.0 MiB 1 height=plugin_config.wordcloud_height,
74 461.9 MiB 0.0 MiB 1 background_color=plugin_config.wordcloud_background_color,
75 461.9 MiB 0.0 MiB 1 colormap=plugin_config.wordcloud_colormap,
76 461.9 MiB 0.0 MiB 1 mask=get_mask(mask_key),
77 )
78 520.5 MiB 58.7 MiB 1 image = wordcloud.generate_from_frequencies(frequency).to_image()
79 520.5 MiB 0.0 MiB 1 image_bytes = BytesIO()
80 520.5 MiB 0.0 MiB 1 image.save(image_bytes, format="PNG")
81 520.5 MiB 0.0 MiB 1 return image_bytes
82 except ValueError:
83 pass
01-30 02:08:55 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_wordcloud) running complete