6 Commits

Author SHA1 Message Date
ebeb62f72d 性能改进 2025-10-07 23:30:16 +08:00
d71d8eb1ec 更新 2025-10-07 23:23:17 +08:00
4ac12479cc 修改 2025-10-07 03:00:42 +08:00
7fc53e4113 算法与交互改进, 以及同步原型 2025-10-07 02:49:26 +08:00
06c62e284d 更新版本号 2025-10-03 13:41:41 +08:00
d5d31eb5fe 改进 2025-10-02 16:49:27 +08:00
6 changed files with 20 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ import particles as pt
import datetime
import pathlib
import math
import time
MINIMAL_REPEATATION = 2
FILTER = "ALL"
@@ -44,6 +45,9 @@ for i in filelist:
metadata_note_cnt = 0
metadata_kwrd_cnt = 0
for i in nucu.nucleons:
if i.content[-1] != "/":
print('检测到不规范字符串')
print(i.content)
content_cnt += len(i.content)
metadata_trsl_cnt += len(str(i.metadata["translation"]))
metadata_kwrd_cnt += len(str(i.metadata["keyword_note"]))
@@ -53,6 +57,7 @@ for i in filelist:
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)}")
#time.sleep(0.1)
text_counter += (content_cnt + metadata_cnt)
content_counter += content_cnt
time_counter += math.ceil(len(nucu.nucleons) / PAYLOAD)

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env python3
ver = "0.3.7"
stage = "prototype"
ver = "0.3.8"
stage = "production"

View File

@@ -41,7 +41,7 @@ class Glimpse():
class Apparatus():
"""反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局"""
def __init__(self, screen, reactor, atom):
def __init__(self, screen, reactor, atom, is_review = 0):
self.electron: pt.Electron = atom[0]
self.nucleon: pt.Nucleon = atom[1]
self.positron: dict = atom[2]
@@ -56,11 +56,14 @@ class Apparatus():
continue
if i == "fill_blank_test": # 加深
self.procession.append(comps.registry[i](screen, reactor, atom))
self.procession.append(comps.registry[i](screen, reactor, atom))
# self.procession.append(comps.registry[i](screen, reactor, atom))
self.procession.append(comps.registry[i](screen, reactor, atom))
# self.procession.reverse()
random.shuffle(self.procession)
if self.positron["is_new_activation"] == 0:
self.procession.append(comps.registry['recognition'](screen, reactor, atom))
if is_review == 1:
self.procession = [self.procession[-2], self.procession[-1]]
def iterator(self):
yield from self.procession
@@ -69,6 +72,7 @@ class Reactor():
"""反应堆对象, 处理和分配一次文件记忆流程的资源与策略"""
def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, screen, tasked_num):
# 导入原子对象
self.stage = 0
self.nucleon_file = nucleon_file
self.electron_file = electron_file
self.tasked_num = tasked_num
@@ -132,6 +136,7 @@ class Reactor():
2: self.atoms_new,
3: (self.atoms_new + self.atoms_review)
}
self.stage = stage
ret = 1
if stage == 1 and len(processions[1]) == 0:
stage = 2
@@ -163,7 +168,7 @@ class Reactor():
return -1 # 此轮已完成
self.index += step
self.current_atom = self.procession[self.index]
self.current_appar = Apparatus(self.screen, self, self.current_atom).iterator()
self.current_appar = Apparatus(self.screen, self, self.current_atom, (self.stage == 1)).iterator()
return 0
def save(self):

View File

@@ -19,7 +19,6 @@ from textual.screen import Screen
from textual.worker import Worker, get_current_worker
import pathlib
import threading
import edge_tts as tts
from playsound import playsound
import particles as pt
from reactor import Reactor, Apparatus, Glimpse
@@ -95,6 +94,7 @@ class PrecachingScreen(Screen):
cache = cache_dir / f"{aux.get_md5(text)}.wav"
if not cache.exists():
try:
import edge_tts as tts
communicate = tts.Communicate(text, "zh-CN-XiaoxiaoNeural")
communicate.save_sync(str(cache))
return True
@@ -216,7 +216,6 @@ class PrecachingScreen(Screen):
self.precache_worker.cancel()
self.app.exit()
class MemScreen(Screen):
BINDINGS = [
("d", "toggle_dark", "改变色调"),
@@ -331,6 +330,7 @@ class MemScreen(Screen):
cache_dir.mkdir(parents=True, exist_ok=True)
cache = cache_dir / f"{aux.get_md5(self.reactor.current_atom[1].content.replace('/',''))}.wav"
if not cache.exists():
import edge_tts as tts
communicate = tts.Communicate(
self.reactor.current_atom[1].content.replace("/", ""),
"zh-CN-XiaoxiaoNeural",
@@ -475,7 +475,7 @@ class DashboardScreen(Screen):
Label("选择待学习或待修改的记忆单元集:", classes="title-label"),
ListView(id="file-list", classes="file-list-view"),
#Button("新建空的单元集", id="new_nucleon_button"),
Button("预缓存所有音频", id="precache_all_button", variant="success"),
Button("音频预缓存实用程序", id="precache_all_button"),
Label(f"\"潜进\" 开放源代码软件项目 | 版本 {metadata.ver} {metadata.stage.capitalize()} | Wang Zhiyu 2025"),
)
yield Footer()

1
sync_t.py Normal file
View File

@@ -0,0 +1 @@
# 同步工具 原型