From 4da80d26a395c73ee6cde060e8206bbe3f2ff8d6 Mon Sep 17 00:00:00 2001 From: david-ajax Date: Thu, 2 Oct 2025 00:40:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=84=E5=88=92=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=99=A8=E5=AE=9E=E7=94=A8=E7=A8=8B=E5=BA=8F,=20?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=20shebang=20=E5=92=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auxiliary.py | 1 + compositions.py | 1 + estimator.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 1 + metadata.py | 1 + particles.py | 1 + precache.py | 1 + puzzles.py | 1 + reactor.py | 1 + screens.py | 1 + serve.py | 1 + tweak.py | 1 + 12 files changed, 73 insertions(+) create mode 100644 estimator.py diff --git a/auxiliary.py b/auxiliary.py index a8fca8f..a3f4b15 100644 --- a/auxiliary.py +++ b/auxiliary.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import time import pathlib import toml diff --git a/compositions.py b/compositions.py index 0a16f2f..1e57602 100644 --- a/compositions.py +++ b/compositions.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from textual.app import App, ComposeResult from textual.events import Event from textual.widgets import ( diff --git a/estimator.py b/estimator.py new file mode 100644 index 0000000..1db5899 --- /dev/null +++ b/estimator.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# 模拟规划完成所有记忆单元集文件的最小时间 +import os +import particles as pt +import datetime +import pathlib +import math + +MINIMAL_REPEATATION = 2 +FILTER = "ALL" +WORST_EF = 5 +PAYLOAD = 8 + +print("SM-2 任务预规划实用程序") +print(f"运行时刻: {datetime.datetime.now()}") +print(f" > 筛选器模式: {FILTER}") +print(f" > 最小重复次数设置: {MINIMAL_REPEATATION}") +print(f" > 最坏难度系数: {WORST_EF}") +print(f" > 单日单元负荷: {PAYLOAD}") + +print("--------") + +filelist = [] + +if FILTER == "ALL": + for i in os.listdir('./nucleon'): + if "toml" in i: + print("扫描到记忆单元集: " + i) + filelist.append(i) + print(f"共需记忆 {len(filelist)} 个记忆单元集") +else: + filelist = [FILTER] + +print("--------") +time_counter = 0 +text_counter = 0 +content_counter = 0 +for i in filelist: + print(f"处理: {i}") + nucu = pt.NucleonUnion(pathlib.Path("./nucleon/" + i)) + print(f"记忆单元数: {len(nucu.nucleons)}") + content_cnt = 0 + metadata_trsl_cnt = 0 + metadata_note_cnt = 0 + metadata_kwrd_cnt = 0 + for i in nucu.nucleons: + content_cnt += len(i.content) + metadata_trsl_cnt += len(str(i.metadata["translation"])) + metadata_kwrd_cnt += len(str(i.metadata["keyword_note"])) + metadata_note_cnt += len(str(i.metadata["note"])) + print(" - 原文文字数: " + str(content_cnt)) + metadata_cnt = metadata_kwrd_cnt + metadata_note_cnt + metadata_trsl_cnt + print(" - 元数据字数: " + str(metadata_cnt) + f"\n = {metadata_trsl_cnt}[翻译] + {metadata_kwrd_cnt}[关键词] + {metadata_note_cnt}[笔记]") + print(f" - 总文字数: {content_cnt + metadata_cnt}") + print(f"独占记忆时间: {len(nucu.nucleons) / PAYLOAD} -> {math.ceil(len(nucu.nucleons) / PAYLOAD)}") + text_counter += (content_cnt + metadata_cnt) + content_counter += content_cnt + time_counter += math.ceil(len(nucu.nucleons) / PAYLOAD) + print("--------") +for i in range(MINIMAL_REPEATATION): + print(f"若按计划进行, 最长需要 {time_counter + (i + 1) * 6} 天完成全部内容的第 {i + 1} 次记忆") +print(f"规划包含 {content_counter} 字, 附加了 {text_counter - content_counter} 字的元数据内容, 共计 {text_counter} 字") \ No newline at end of file diff --git a/main.py b/main.py index 0c5963e..1f425a1 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from textual.app import App import screens import os diff --git a/metadata.py b/metadata.py index b6a265a..de9f65c 100644 --- a/metadata.py +++ b/metadata.py @@ -1,2 +1,3 @@ +#!/usr/bin/env python3 ver = "0.3.7" stage = "prototype" \ No newline at end of file diff --git a/particles.py b/particles.py index 919ce12..6c47dd6 100644 --- a/particles.py +++ b/particles.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import pathlib import toml import time diff --git a/precache.py b/precache.py index d19453c..f83f822 100644 --- a/precache.py +++ b/precache.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # 音频预缓存实用程序, 独立于主程序之外, 但依赖其他组件 import particles as pt import auxiliary as aux diff --git a/puzzles.py b/puzzles.py index c8e27b3..9e96e3d 100644 --- a/puzzles.py +++ b/puzzles.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import random diff --git a/reactor.py b/reactor.py index 7c117cc..8e2483e 100644 --- a/reactor.py +++ b/reactor.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import typing import particles as pt import pathlib diff --git a/screens.py b/screens.py index eca7fcd..8621dbb 100644 --- a/screens.py +++ b/screens.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from textual.app import App, ComposeResult from textual.widgets import ( Header, diff --git a/serve.py b/serve.py index e2e2385..08600e1 100644 --- a/serve.py +++ b/serve.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from webshare import server server = server.Server("python3 main.py", title="辅助记忆程序", host="0.0.0.0") server.serve() diff --git a/tweak.py b/tweak.py index 9bf8643..68d899d 100644 --- a/tweak.py +++ b/tweak.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import os import shutil import subprocess