fix word segmentated search

This commit is contained in:
polv committed 2026-03-06 12:57:20 +07:00
1 parent 1614db6e99
commit dd52b82cc7
9 files changed
+54 -8

No files matched your search

+1 -1
View File
@@ -5,5 +5,5 @@ pub fn get_db_dir() -> PathBuf {
} }
pub fn get_vibrato_dict_dir() -> PathBuf { pub fn get_vibrato_dict_dir() -> PathBuf {
PathBuf::from("src-tauri/resources/ipadic-mecab/system.dic.zst") PathBuf::from("src-tauri/resources/naist-jdic-mecab/system.dic.zst")
} }
+8 -3
View File
@@ -1,3 +1,5 @@
use std::env::args;
use cjdic2_core::AppService; use cjdic2_core::AppService;
mod common; mod common;
@@ -8,11 +10,14 @@ use crate::common::get_vibrato_dict_dir;
fn main() -> Result<(), anyhow::Error> { fn main() -> Result<(), anyhow::Error> {
let service = AppService::new(get_db_dir(), get_vibrato_dict_dir())?; let service = AppService::new(get_db_dir(), get_vibrato_dict_dir())?;
let mut arg_it = args();
arg_it.next();
println!( println!(
"{:#?}", "{:#?}",
service.ja_tokenize( service.ja_tokenize(arg_it.next().unwrap_or(
"予約キャンセル・変更は【配信日前日の19時頃】までに行ってください。".to_string() "武器・防具≪エルガー武器商会≫の裏の鍛冶場を調べ「錆びた鍵」を入手します ".to_string()
)? ))?
); );
Ok(()) Ok(())
+2 -2
View File
@@ -53,7 +53,7 @@ function SearchPage() {
if (!isMonitorClipboard) return; if (!isMonitorClipboard) return;
const intervalId = setInterval(async () => { const intervalId = setInterval(async () => {
const newText = await readText(); const newText = (await readText()).replace(/ /g, "");
set_clipboardText((clipboardText) => { set_clipboardText((clipboardText) => {
if (clipboardText !== newText) { if (clipboardText !== newText) {
@@ -134,7 +134,7 @@ function SearchPage() {
}); });
if (isNew) { if (isNew) {
if (!result.length && !isFromSplit && ender === "" && q.length > 2) { if (!result.length && !isFromSplit && /^[^ ]{3,} $/.test(q)) {
const segs = await invoke<{ surface: string }[]>("tokenize", { const segs = await invoke<{ surface: string }[]>("tokenize", {
text: q, text: q,
}); });
+2
View File
@@ -6,4 +6,6 @@
/tauri.properties /tauri.properties
/src/main/assets/**/*.zip /src/main/assets/**/*.zip
/src/main/assets/**/*.zst
/src/main/assets/**/*.db
/src/main/assets/**/manifest.json /src/main/assets/**/manifest.json
@@ -0,0 +1,32 @@
Copyright (c) 2009, Nara Institute of Science and Technology, Japan.
Copyright 2023, LegalOn Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the Nara Institute of Science and Technology
(NAIST) nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,7 @@
This software includes a binary version of data from
https://ja.osdn.net/projects/naist-jdic/downloads/53500/mecab-naist-jdic-0.6.3b-20111013.tar.gz
where the connection ids are remapped using CORE data in BCCWJ (except the PN category)
https://clrd.ninjal.ac.jp/bccwj/.
+1 -1
View File
@@ -21,7 +21,7 @@ pub fn run() {
let dict_path = { let dict_path = {
// Resolve the resource path (returns asset://localhost/ URI on Android) // Resolve the resource path (returns asset://localhost/ URI on Android)
let resource_path = app.path().resolve( let resource_path = app.path().resolve(
"resources/ipadic-mecab/system.dic.zst", "resources/naist-jdic-mecab/system.dic.zst",
tauri::path::BaseDirectory::Resource, tauri::path::BaseDirectory::Resource,
)?; )?;
+1 -1
View File
@@ -24,7 +24,7 @@
}, },
"bundle": { "bundle": {
"resources": [ "resources": [
"resources/**/system.dic.zst" "resources/naist-jdic-mecab/system.dic.zst"
], ],
"active": true, "active": true,
"targets": "all", "targets": "all",