aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/example_rule.json
diff options
context:
space:
mode:
Diffstat (limited to 'test/example_rule.json')
-rw-r--r--test/example_rule.json94
1 files changed, 38 insertions, 56 deletions
diff --git a/test/example_rule.json b/test/example_rule.json
index 0cb5b6c..750789a 100644
--- a/test/example_rule.json
+++ b/test/example_rule.json
@@ -1,66 +1,48 @@
-[
+{
+ "metadata": {
+ // 匹配日志元数据,提取 id、QQ 账号和时间。例如:墨勒托.DW(1571806261) 2025-01-27 19:58:15
+ "type": "metadata",
+ "patterns": [
+ "^(\\S+)\\((\\d+)\\)\\s+(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})"
+ ],
+ "groups": ["user_name", "user_id", "time"]
+ },
+ "content": [
{
- // 匹配日志元数据,提取 id、QQ 账号和时间。例如:墨勒托.DW(1571806261) 2025-01-27 19:58:15
- "type": "metadata",
- "patterns": [
- "^(\\S+)\\((\\d+)\\)\\s+(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})"
- ],
- "groups": [
- "user_name",
- "user_id",
- "time"
- ]
+ "type": "action",
+ "patterns": ["^#s*((?:(?![“”\"(【】]).)+)"], // 排除后续特殊符号
+ "groups": ["action_content"]
},
{
- "type": "action",
- "patterns": [
- "^#s*((?:(?![“”\"(【】]).)+)"
- ], // 排除后续特殊符号
- "groups": [
- "action_content"
- ]
+ "type": "speech",
+ "patterns": [
+ "[“](.+?)[”]", // 中文引号
+ "\"(.*?)\"", // 英文引号
+ "”(.+?)“" // 混合引号
+ ],
+ "groups": ["speech_content"]
},
{
- "type": "speech",
- "patterns": [
- "[“](.+?)[”]", // 中文引号
- "\"(.*?)\"", // 英文引号
- "”(.+?)“" // 混合引号
- ],
- "groups": [
- "speech_content"
- ]
+ "type": "ooc_speech",
+ "patterns": [
+ // "((.*?))", // 英文括号
+ "((.*?))", // 中文括号
+ // "((.*)", // 未闭合英文括号
+ "((.*)" // 未闭合中文括号
+ ],
+ "groups": ["ooc_content"]
},
{
- "type": "ooc_speech",
- "patterns": [
- // "((.*?))", // 英文括号
- "((.*?))", // 中文括号
- // "((.*)", // 未闭合英文括号
- "((.*)" // 未闭合中文括号
- ],
- "groups": [
- "ooc_content"
- ]
+ // 匹配掷骰指令,以 . 或 。开头但是不匹配连续的指令前缀。例如:匹配".ra智力",不匹配"。。。"
+ "type": "dice_order",
+ "patterns": ["^(?:[\\.。]([^.。].+))"],
+ "groups": ["dice_command"]
},
{
- // 匹配掷骰指令,以 . 或 。开头但是不匹配连续的指令前缀。例如:匹配".ra智力",不匹配"。。。"
- "type": "dice_order",
- "patterns": [
- "^(?:[\\.。]([^.。].+))"
- ],
- "groups": [
- "dice_command"
- ]
- },
- {
- // 匹配角色心理活动。例如:【这里好可怕】
- "type": "thought",
- "patterns": [
- "【(.+)】"
- ],
- "groups": [
- "thought_content"
- ]
+ // 匹配角色心理活动。例如:【这里好可怕】
+ "type": "thought",
+ "patterns": ["【(.+)】"],
+ "groups": ["thought_content"]
}
-] \ No newline at end of file
+ ]
+}