AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻译准备中
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证正在加载完整 README。 以下为已保存的摘录。
Name the rules. Get the tokens. lectes is a small Python scanner (lexer)
generator. Give it named regexes, and it yields tokens.查看完整 README ↗Name the rules. Get the tokens. lectes is a small Python scanner (lexer) generator. Give it named regexes, and it yields tokens.
NAME regex rule per line, in Python or in a
.lectes file.lectes command. Scan files or stdin from the shell, as aligned text
or JSON Lines.Try it in the playground: lectes.dev lets you write a grammar and see the tokens as you type, right in your browser. Hover a token to see which rules fought for it.
As a library:
pip install lectes # or: uv add lectes
As a command-line tool:
uv tool install lectes # or: pipx install lectes
uvx lectes grammar.lectes input.txt # run once without installing
from lectes import Configuration, Scanner
config = Configuration.from_text(r"""
# Longest match wins; on a tie, the earlier rule wins.
FOR for
IN in
ID [a-zA-Z_][a-zA-Z0-9_]*
INT [0-9]+
WS [ ]+
""")
scanner = Scanner(config)
for token in scanner.scan("for item in items format 42"):
if token.rule.name != "WS":
print(token.location.column, token.rule.name, repr(token.literal))
1 FOR 'for'
5 ID 'item'
10 IN 'in'
13 ID 'items'
19 ID 'format'
26 INT '42'
for matches both FOR and ID with the same length, so the earlier rule,
FOR, wins. format is an ID, because the longer match always wins.
You can also build the rules in Python:
from lectes import Configuration, Regex, Rule
config = Configuration(
[
Rule(name="FOR", regex=Regex("for")),
Rule(name="ID", regex=Regex("[a-zA-Z_][a-zA-Z0-9_]*")),
]
)
The usage guide covers grammar errors and warnings, custom handlers, unmatched text and debugging.
The lectes command scans a file, or stdin, with a grammar file:
$ cat arithmetic.lectes
INT [0-9]+
PLUS \+
WS \s+
$ echo '12 + 3' | lectes arithmetic.lectes
1:1 INT '12'
1:3 WS ' '
1:4 PLUS '+'
1:5 WS ' '
1:6 INT '3'
1:7 WS '\n'
Use --format json for JSON Lines output, and --check to validate a grammar
without scanning. The exit codes are 0 on success, 1 for unmatched text, and 2
for a usage, grammar or I/O error. See the
command-line docs for every option.