From a4fb55a3e63685053ac4dc8eed65df195410df26 Mon Sep 17 00:00:00 2001 From: nkowne63rt Date: Sat, 6 May 2023 17:03:26 +0900 Subject: [PATCH 1/2] add: ja section --- main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.js b/main.js index d8adef3d..4194c972 100644 --- a/main.js +++ b/main.js @@ -55,6 +55,11 @@ const SMART_TRANSLATION = { "prompt": "Sulla base degli appunti", "initial_message": "Ciao, sono ChatGPT e ho accesso ai tuoi appunti tramite Smart Connections. Fatemi una domanda sui vostri appunti e cercherò di rispondervi.", }, + "ja": { + "pronous": ["私", "自分", "僕", "俺", "私達", "この"], + "prompt": "このノートに基づいて", + "initial_message": "こんにちは、スマートコネクションであなたのノートにアクセスできるChatGPTです。あなたのノートに関する質問を私に投げかけてください。", + }, } class SmartConnectionsPlugin extends Obsidian.Plugin { From 4ab59174e63288db6a6267a00323fb96b516a46c Mon Sep 17 00:00:00 2001 From: nkowne63rt Date: Sat, 6 May 2023 17:44:39 +0900 Subject: [PATCH 2/2] fix: support for unsegmented language --- main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 4194c972..ed6dd5be 100644 --- a/main.js +++ b/main.js @@ -59,6 +59,7 @@ const SMART_TRANSLATION = { "pronous": ["私", "自分", "僕", "俺", "私達", "この"], "prompt": "このノートに基づいて", "initial_message": "こんにちは、スマートコネクションであなたのノートにアクセスできるChatGPTです。あなたのノートに関する質問を私に投げかけてください。", + "unsegmented": true }, } @@ -226,7 +227,10 @@ class SmartConnectionsPlugin extends Obsidian.Plugin { }); } // load self_ref_kw_regex - this.self_ref_kw_regex = new RegExp(`\\b(${SMART_TRANSLATION[this.settings.language].pronous.join("|")})\\b`, "gi"); + this.self_ref_kw_regex = + !SMART_TRANSLATION[this.settings.language].unsegmented + ? new RegExp(`\\b(${SMART_TRANSLATION[this.settings.language].pronous.join("|")})\\b`, "gi") + : new RegExp(`(${SMART_TRANSLATION[this.settings.language].pronous.join("|")})`, "gi"); // load failed files await this.load_failed_files(); }