检查、匹配和抵抗的方法。基于regex的面向对象文本分析器
vbml的Python项目详细描述
[VBML]完美的pythonistic解析器/字符串操纵器:火花: 在
在
特点
- 清理基于
regex
的解析器 - 易于理解的验证器/自定义验证器
- 有很多现成的功能
I am <name>, i am <age:int> years old
+I am Steven, i am 20 years old
={"name": "Steven", "age": 20}
安装
使用pip安装:
pip install vbml
或者用诗歌:
^{pr2}$运行测试
从git克隆回购:
git clone https://github.com/tesseradecade/vbml.git
转到存储库并使用poetry
运行测试:
cd vbml
poetry install
poetry run pytest
:book:文档
完整的文档内容可在docs/index.md中找到
简单的例子
fromvbmlimportPatcher,Patternpatcher=Patcher()pattern=Pattern("He is <description> like he has right just turned <age:int> years old")result1=patcher.check(pattern,"He is so spontaneous like he has right just turned 10 years old")result2=patcher.check(pattern,"He is silly like he has right just turned t3n years old")result3=patcher.check(pattern,"Haha regex go brrr")result1# {"description": "so spontaneous", "age": 10}result2# Noneresult3# None
留下a:star:如果这个项目对你有帮助
制作:心:作者timoniq
- 项目
标签: