From d69a55aeb69d20a3dc09bf468ee454aa879738a6 Mon Sep 17 00:00:00 2001 From: ARCJ137442 <61109168+ARCJ137442@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:03:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BF=AE=E5=A4=8DONA=E4=B8=AD?= =?UTF-8?q?=E5=9B=A0=E3=80=8CoccurenceTime=3DXXX=E3=80=8D=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E3=80=8C=E6=97=A0=E6=B3=95=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=B8=A6=E6=97=B6=E6=80=81=E8=AF=AD=E5=8F=A5=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E7=9C=9F=E5=80=BC=E3=80=8D=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cin_implements/ona/translators.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cin_implements/ona/translators.rs b/src/cin_implements/ona/translators.rs index 86824d9..961d6d0 100644 --- a/src/cin_implements/ona/translators.rs +++ b/src/cin_implements/ona/translators.rs @@ -376,6 +376,8 @@ fn reform_output_to_narsese(out: &str) -> String { let re_truth = Regex::new(r"Truth:\s*frequency=([0-9.]+),\s*confidence=([0-9.]+)").unwrap(); // 匹配ONA输出的「创建时间」⇒删去 let re_creation_t = Regex::new(r"creationTime=([0-9.]+)\s+").unwrap(); + // 匹配ONA输出的「发生时间」⇒删去 + let re_occurrence_t = Regex::new(r"occurrenceTime=([0-9.]+)\s+").unwrap(); // 匹配ONA输出的「时间递进」⇒删去 let re_dt = Regex::new(r"dt=([0-9.]+)\s+").unwrap(); // 匹配ONA输出的「优先级」⇒删去 @@ -396,6 +398,9 @@ fn reform_output_to_narsese(out: &str) -> String { // 删去非必要的「创建时间」 => [re_creation_t.replace_all](_, "") => #{&} // 必须借用 + // 删去非必要的「发生时间」 + => [re_occurrence_t.replace_all](_, "") + => #{&} // 必须借用 // 删去非必要的「递进时间」 => [re_dt.replace_all](_, "") => #{&} // 必须借用 @@ -681,8 +686,7 @@ mod test { // 正常解析并展示Narsese if let Some(narsese) = o.get_narsese() { println!("{}", FORMAT_ASCII.format_narsese(narsese)) - } - else { + } else { println!("[{}] {}", o.type_name(), o.raw_content()) } }