duangsuse::Echo
716 subscribers
4.25K photos
130 videos
583 files
6.47K links
import this:
美而不丑、明而不暗、短而不凡、长而不乱,扁平不宽,读而后码,行之天下,勿托地上天国。
异常勿吞,难过勿过,叹一真理。效率是很重要,盲目最是低效。
简明是可靠的先验,不是可靠的祭品。
知其变,守其恒,为天下式;穷其变,知不穷,得地上势。知变守恒却穷变知新,我认真理,我不认真。

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
https://pypi.org/project/srt/ …… 我看我还是做抽象一点 🤔不就是个 subtitle 时间轴嘛
我利用了之前设计的 Fold 架构,把 ocrWithLocalMaxima 的实际操作抽提出来了
🤔 #Python #code 之前我看 SCP-079 群里那个翻译的实现(用的不是 Qt 封的 translate 什么的),他们是这个格式
{
"admin": (zh_cn and "管理员") or "Administrator"
}
第一次看到的时候,我觉得好高大上啊,而且以为他们肯定重载了 and / or operator 的语义,甚至在脑内自动意淫出了一个递归结构:
(后来发现递归的其实是一个链表)

class Translation:
def __init__(self, lang, text):
self.lang, self.text = lang, text
class Link:
def __init__(self, head, tail):
self.head, self.tail = head, tail

def _and(lang, text): return Translation(lang, text)
def _or(translation, tail): return Link(translation, tail)


然后我编写了一个查表算法(后来被证实不过是链表查找,开始我还以为是高大上的递归结构呢):

def getTranslation(key, lang):
current = translations[key]
while current != None:
if current.head.lang == lang: return current.head.text
raise KeyError(f"undefined {key} for {lang}")


再后来,我发现这整个其实都是谎话—— 使用这种方式意味着 SCP-079 用 zh_cn: bool 作为参数,然后利用 truthy/falsey value 的动态类型特性,去 "Hack" 一个 EDSL(embedded domain specific lang.)……
如果要缓存,结果是一个关于 zh_cn 之类的 boolMap<LangID, Map<TextID, Text>>
我看还不如这样吧:
{
"admin": i18n(zh_cn="管理员", en_us="Administrator")
}

def i18n(**kwargs):
require(all(map(languages.__contains__, map(dict.key, kwargs) )), "unsupported language")
return kwargs (草,这么直白太过分……)
是这个,没想到被实现为了全局变量……
Forwarded from ActionFilament
确实是支持中英的
新默写的 guiSelectionUMat(mat) 草,写错了,不讲逻辑和状态迁移,明明在 LMouseUp 的时候才 redraw 的……
草,修了两处后真的可以用
This media is not supported in your browser
VIEW IN TELEGRAM
一直以来 duangsuse 都是以对程序表达是熟练度为第一要务的,没想到连状态机都不熟悉,真是……
突然觉得自己好傻逼,这个 merge 到底是做什么操作…… 我知道它在 reduce 更新一个变量,但第一次写错了(消耗-重赋值顺序错误),而且现在我也不知道这种代码风格也没有办法优化
This media is not supported in your browser
VIEW IN TELEGRAM
这个程序运行的结果是这样,可我的智商不够,即便它是我写的我也不知道具体为什么能达成这个结果,即便算法并不复杂。 ./timeline_ops.py merge frames/timeline_SomethingNew.mp4.txt 0.25
This media is not supported in your browser
VIEW IN TELEGRAM
有了这个 merge 操作,也算是把视频帧偏差量算法的问题(不是我的领域,我没法修复)给“变废为宝”了(迫真)
duangsuse::Echo
158 How can something be so nice? 178 Yet so shocking, yet so nice. 321 How can something be so new? 403 Yet so known but yet so new? 466 Ohh, one two, three, the time has gone. 494 Problematic things undone. 585 How an something be so cruel? 640 Yet so warm…
122-163 "How can something be so nice?"
178-250 "Yet so shocking, yet so nice."
283-321 "How can something be so new?"
358-387 "Yet so known but yet so new?"
430-466 "Ohh, one two, three, the time has gone."
494-506 "Problematic things undone."
537-587 "How can something be so cruel?"
610-657 "Yet so warm but yet so cruel?"
684-966 ""
990-996 "Try to find from a different sight,"
1039-1077 "Get to choose where to look back,"
1096-1235 "Resolve what others can't do for now..."
1279-1366 "What a beautiful way to fix all wrong things."
1383-1486 "Evolve future generations of work teams."
1516-1612 "But tell me why's that fear of yours,"
1646-1738 " 'Cause you know it is going to work... (keep it up)"
1757-1833 "Let's start from now, stay tuned, you're half way through!"
1868-1903 "Break it, crash it, take it farther"
1950-1978 "Making something even smarter.”"
1993-2030 "Do it, start it, make it happen,"
2048-2096 "Stab in statements screaming louder."
2119-2187 "How can something be so nice?"
2207-2239 "Yet so shocking, yet so nice."
2261-2281 "How can something be so new?"
2334-2399 "Yet so known but yet..."
2424-2699 "IT'S SOMETHING NEW"
This media is not supported in your browser
VIEW IN TELEGRAM
直接作为可以从视频里拖出 subtitle 的工具了,虽然我不打算进一步包装好
现在已经可以从字幕视频制作歌词,考虑一下加个 SRT 转化的功能