mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
fix word segmentated search
This commit is contained in:
1 parent
1614db6e99
commit
dd52b82cc7
9 files changed
+54
-8
No files matched your search
@@ -5,5 +5,5 @@ pub fn get_db_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")
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::env::args;
|
||||
|
||||
use cjdic2_core::AppService;
|
||||
|
||||
mod common;
|
||||
@@ -8,11 +10,14 @@ use crate::common::get_vibrato_dict_dir;
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let service = AppService::new(get_db_dir(), get_vibrato_dict_dir())?;
|
||||
|
||||
let mut arg_it = args();
|
||||
arg_it.next();
|
||||
|
||||
println!(
|
||||
"{:#?}",
|
||||
service.ja_tokenize(
|
||||
"予約キャンセル・変更は【配信日前日の19時頃】までに行ってください。".to_string()
|
||||
)?
|
||||
service.ja_tokenize(arg_it.next().unwrap_or(
|
||||
"武器・防具≪エルガー武器商会≫の裏の鍛冶場を調べ「錆びた鍵」を入手します ".to_string()
|
||||
))?
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -53,7 +53,7 @@ function SearchPage() {
|
||||
if (!isMonitorClipboard) return;
|
||||
|
||||
const intervalId = setInterval(async () => {
|
||||
const newText = await readText();
|
||||
const newText = (await readText()).replace(/ /g, "");
|
||||
|
||||
set_clipboardText((clipboardText) => {
|
||||
if (clipboardText !== newText) {
|
||||
@@ -134,7 +134,7 @@ function SearchPage() {
|
||||
});
|
||||
|
||||
if (isNew) {
|
||||
if (!result.length && !isFromSplit && ender === "" && q.length > 2) {
|
||||
if (!result.length && !isFromSplit && /^[^ ]{3,} $/.test(q)) {
|
||||
const segs = await invoke<{ surface: string }[]>("tokenize", {
|
||||
text: q,
|
||||
});
|
||||
|
||||
@@ -6,4 +6,6 @@
|
||||
/tauri.properties
|
||||
|
||||
/src/main/assets/**/*.zip
|
||||
/src/main/assets/**/*.zst
|
||||
/src/main/assets/**/*.db
|
||||
/src/main/assets/**/manifest.json
|
||||
Binary file not shown.
@@ -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/.
|
||||
@@ -21,7 +21,7 @@ pub fn run() {
|
||||
let dict_path = {
|
||||
// Resolve the resource path (returns asset://localhost/ URI on Android)
|
||||
let resource_path = app.path().resolve(
|
||||
"resources/ipadic-mecab/system.dic.zst",
|
||||
"resources/naist-jdic-mecab/system.dic.zst",
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"bundle": {
|
||||
"resources": [
|
||||
"resources/**/system.dic.zst"
|
||||
"resources/naist-jdic-mecab/system.dic.zst"
|
||||
],
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
|
||||
Reference in new issue
Block a user