From 421dd2a20c82339392359ff7302f09e469a0c27c Mon Sep 17 00:00:00 2001 From: pine Date: Sat, 15 Mar 2025 17:54:57 +0800 Subject: chore: 📝 Update example_log.log & example_rule.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/example_log.log | 8 ++++++- test/example_rule.json | 58 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/test/example_log.log b/test/example_log.log index aff1d3a..b7e8597 100644 --- a/test/example_log.log +++ b/test/example_log.log @@ -10,6 +10,12 @@ MIKU(2754533655) 2025-01-27 19:58:39 以实玛利(1316702392) 2025-01-27 19:58:42 “很高兴认识你,我是以实玛利” +麦奎恩·马瑟斯(602380092) 2025-01-27 20:05:18 +“你好,”#向前伸出手,“鄙人马瑟斯” + +麦奎恩·马瑟斯(602380092) 2025-01-27 20:05:18 +【这人不简单啊】#和对方握手,“幸会幸会” + 以实玛利(1316702392) 2025-01-27 20:00:02 (白师傅,能不能别念了) @@ -32,4 +38,4 @@ MIKU(2754533655) 2025-01-27 20:02:06 也站起身子探头探脑的看了看办公室 MIKU(2754533655) 2025-01-27 20:02:18 -可以注意到瑞德曼的办公桌上有一份卷宗,卷宗上写着“4·22 袭警案调查报告”的字样: \ No newline at end of file +可以注意到瑞德曼的办公桌上有一份卷宗,卷宗上写着“4·22袭警案调查报告”的字样: \ No newline at end of file diff --git a/test/example_rule.json b/test/example_rule.json index d385f38..0cb5b6c 100644 --- a/test/example_rule.json +++ b/test/example_rule.json @@ -1,32 +1,66 @@ [ { - "pattern": "^(\\S+)\\((\\d+)\\)\\s+(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})", + // 匹配日志元数据,提取 id、QQ 账号和时间。例如:墨勒托.DW(1571806261) 2025-01-27 19:58:15 "type": "metadata", - "description": "匹配日志元数据,提取 id、QQ 账号和时间。例如:墨勒托.DW(1571806261) 2025-01-27 19:58:15" + "patterns": [ + "^(\\S+)\\((\\d+)\\)\\s+(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})" + ], + "groups": [ + "user_name", + "user_id", + "time" + ] }, { - "pattern": "^#(.+)", "type": "action", - "description": "匹配行动,以 # 开头。例如:# 我推开门" + "patterns": [ + "^#s*((?:(?![“”\"(【】]).)+)" + ], // 排除后续特殊符号 + "groups": [ + "action_content" + ] }, { - "pattern": "“(.+)”", "type": "speech", - "description": "匹配玩家发言,双引号内的内容。例如:\"你好,我是冒险者\"" + "patterns": [ + "[“](.+?)[”]", // 中文引号 + "\"(.*?)\"", // 英文引号 + "”(.+?)“" // 混合引号 + ], + "groups": [ + "speech_content" + ] }, { - "pattern": "\\((.+)\\)", "type": "ooc_speech", - "description": "匹配场外发言,括号内的内容。例如:(今天没时间跑团)" + "patterns": [ + // "((.*?))", // 英文括号 + "((.*?))", // 中文括号 + // "((.*)", // 未闭合英文括号 + "((.*)" // 未闭合中文括号 + ], + "groups": [ + "ooc_content" + ] }, { - "pattern": "^(?:[\\.。]([^.。].+))", + // 匹配掷骰指令,以 . 或 。开头但是不匹配连续的指令前缀。例如:匹配".ra智力",不匹配"。。。" "type": "dice_order", - "description": "匹配掷骰指令,以 . 或 。 开头但是不匹配连续的指令前缀。例如:匹配.ra智力,不匹配'。。。'" + "patterns": [ + "^(?:[\\.。]([^.。].+))" + ], + "groups": [ + "dice_command" + ] }, { - "pattern": "【(.+)】", + // 匹配角色心理活动。例如:【这里好可怕】 "type": "thought", - "description": "匹配角色心理活动。例如:【这里好可怕】" + "patterns": [ + "【(.+)】" + ], + "groups": [ + "thought_content" + ] } ] \ No newline at end of file -- cgit v1.2.3-70-g09d2