Compare commits
5 Commits
156f558a45
...
v0.3.8
Author | SHA1 | Date | |
---|---|---|---|
d71d8eb1ec | |||
4ac12479cc | |||
7fc53e4113 | |||
06c62e284d | |||
d5d31eb5fe |
@@ -5,6 +5,7 @@ import particles as pt
|
|||||||
import datetime
|
import datetime
|
||||||
import pathlib
|
import pathlib
|
||||||
import math
|
import math
|
||||||
|
import time
|
||||||
|
|
||||||
MINIMAL_REPEATATION = 2
|
MINIMAL_REPEATATION = 2
|
||||||
FILTER = "ALL"
|
FILTER = "ALL"
|
||||||
@@ -44,6 +45,9 @@ for i in filelist:
|
|||||||
metadata_note_cnt = 0
|
metadata_note_cnt = 0
|
||||||
metadata_kwrd_cnt = 0
|
metadata_kwrd_cnt = 0
|
||||||
for i in nucu.nucleons:
|
for i in nucu.nucleons:
|
||||||
|
if i.content[-1] != "/":
|
||||||
|
print('检测到不规范字符串')
|
||||||
|
print(i.content)
|
||||||
content_cnt += len(i.content)
|
content_cnt += len(i.content)
|
||||||
metadata_trsl_cnt += len(str(i.metadata["translation"]))
|
metadata_trsl_cnt += len(str(i.metadata["translation"]))
|
||||||
metadata_kwrd_cnt += len(str(i.metadata["keyword_note"]))
|
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(" - 元数据字数: " + str(metadata_cnt) + f"\n = {metadata_trsl_cnt}[翻译] + {metadata_kwrd_cnt}[关键词] + {metadata_note_cnt}[笔记]")
|
||||||
print(f" - 总文字数: {content_cnt + metadata_cnt}")
|
print(f" - 总文字数: {content_cnt + metadata_cnt}")
|
||||||
print(f"独占记忆时间: {len(nucu.nucleons) / PAYLOAD} -> {math.ceil(len(nucu.nucleons) / PAYLOAD)}")
|
print(f"独占记忆时间: {len(nucu.nucleons) / PAYLOAD} -> {math.ceil(len(nucu.nucleons) / PAYLOAD)}")
|
||||||
|
#time.sleep(0.1)
|
||||||
text_counter += (content_cnt + metadata_cnt)
|
text_counter += (content_cnt + metadata_cnt)
|
||||||
content_counter += content_cnt
|
content_counter += content_cnt
|
||||||
time_counter += math.ceil(len(nucu.nucleons) / PAYLOAD)
|
time_counter += math.ceil(len(nucu.nucleons) / PAYLOAD)
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
ver = "0.3.7"
|
ver = "0.3.8"
|
||||||
stage = "prototype"
|
stage = "production"
|
13
reactor.py
13
reactor.py
@@ -41,7 +41,7 @@ class Glimpse():
|
|||||||
|
|
||||||
class Apparatus():
|
class Apparatus():
|
||||||
"""反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局"""
|
"""反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局"""
|
||||||
def __init__(self, screen, reactor, atom):
|
def __init__(self, screen, reactor, atom, is_review = 0):
|
||||||
self.electron: pt.Electron = atom[0]
|
self.electron: pt.Electron = atom[0]
|
||||||
self.nucleon: pt.Nucleon = atom[1]
|
self.nucleon: pt.Nucleon = atom[1]
|
||||||
self.positron: dict = atom[2]
|
self.positron: dict = atom[2]
|
||||||
@@ -56,11 +56,14 @@ class Apparatus():
|
|||||||
continue
|
continue
|
||||||
if i == "fill_blank_test": # 加深
|
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.append(comps.registry[i](screen, reactor, atom))
|
self.procession.append(comps.registry[i](screen, reactor, atom))
|
||||||
# self.procession.reverse()
|
# self.procession.reverse()
|
||||||
random.shuffle(self.procession)
|
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):
|
def iterator(self):
|
||||||
yield from self.procession
|
yield from self.procession
|
||||||
|
|
||||||
@@ -69,6 +72,7 @@ class Reactor():
|
|||||||
"""反应堆对象, 处理和分配一次文件记忆流程的资源与策略"""
|
"""反应堆对象, 处理和分配一次文件记忆流程的资源与策略"""
|
||||||
def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, screen, tasked_num):
|
def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, screen, tasked_num):
|
||||||
# 导入原子对象
|
# 导入原子对象
|
||||||
|
self.stage = 0
|
||||||
self.nucleon_file = nucleon_file
|
self.nucleon_file = nucleon_file
|
||||||
self.electron_file = electron_file
|
self.electron_file = electron_file
|
||||||
self.tasked_num = tasked_num
|
self.tasked_num = tasked_num
|
||||||
@@ -132,6 +136,7 @@ class Reactor():
|
|||||||
2: self.atoms_new,
|
2: self.atoms_new,
|
||||||
3: (self.atoms_new + self.atoms_review)
|
3: (self.atoms_new + self.atoms_review)
|
||||||
}
|
}
|
||||||
|
self.stage = stage
|
||||||
ret = 1
|
ret = 1
|
||||||
if stage == 1 and len(processions[1]) == 0:
|
if stage == 1 and len(processions[1]) == 0:
|
||||||
stage = 2
|
stage = 2
|
||||||
@@ -163,7 +168,7 @@ class Reactor():
|
|||||||
return -1 # 此轮已完成
|
return -1 # 此轮已完成
|
||||||
self.index += step
|
self.index += step
|
||||||
self.current_atom = self.procession[self.index]
|
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
|
return 0
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
@@ -216,7 +216,6 @@ class PrecachingScreen(Screen):
|
|||||||
self.precache_worker.cancel()
|
self.precache_worker.cancel()
|
||||||
self.app.exit()
|
self.app.exit()
|
||||||
|
|
||||||
|
|
||||||
class MemScreen(Screen):
|
class MemScreen(Screen):
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
("d", "toggle_dark", "改变色调"),
|
("d", "toggle_dark", "改变色调"),
|
||||||
@@ -475,7 +474,7 @@ class DashboardScreen(Screen):
|
|||||||
Label("选择待学习或待修改的记忆单元集:", classes="title-label"),
|
Label("选择待学习或待修改的记忆单元集:", classes="title-label"),
|
||||||
ListView(id="file-list", classes="file-list-view"),
|
ListView(id="file-list", classes="file-list-view"),
|
||||||
#Button("新建空的单元集", id="new_nucleon_button"),
|
#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"),
|
Label(f"\"潜进\" 开放源代码软件项目 | 版本 {metadata.ver} {metadata.stage.capitalize()} | Wang Zhiyu 2025"),
|
||||||
)
|
)
|
||||||
yield Footer()
|
yield Footer()
|
||||||
|
Reference in New Issue
Block a user