Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望能支援 在搜尋時 無視簡日漢字 #291

Closed
bluelovers opened this issue Jul 8, 2019 · 6 comments
Closed

希望能支援 在搜尋時 無視簡日漢字 #291

bluelovers opened this issue Jul 8, 2019 · 6 comments
Assignees

Comments

@bluelovers
Copy link

希望能支援 在搜尋時 無視簡日漢字

例如像這個一樣 https://demonovel.netlify.com
image

可以在搜尋框內打上任何漢字 然後會自動配對簡繁日漢字

例如搜尋 無視簡日漢字
就會變成 /[无無][眎視视視][简簡]日[汉漢]字/u

@LiMinggang
Copy link
Owner

LiMinggang commented Jul 9, 2019

这像是查表出来的,有什么资料说明吗?

@bluelovers
Copy link
Author

資料說明是指什麼意思?

是指?
https://github.com/bluelovers/regexp-cjk
https://github.com/bluelovers/cjk-convert

https://github.com/bluelovers/cjk-convert/blob/master/lib/jp/table.ts
https://github.com/bluelovers/cjk-convert/blob/master/lib/zh/table/table.ts

這個要實現的話 難度應該只有 是否要支援 能對 regex 作處理而以
因為 madedit 本身就有 簡繁日轉換的對照表

在不考慮支援 regex 的情況下的話 大概就是分割 找出所有漢字 然後查表之後 製作成 regex 這種比較傻一點的方式

要 支援解析 regex 的話就比較麻煩 還得去找相關的庫 來使用避免解析錯誤

@LiMinggang
Copy link
Owner

我看你给出的例子支持正则的方式就是分割查表啊,换掉正则支持的库有点难

@bluelovers
Copy link
Author

恩 要能支援解讀 regex 來自動將裡面的漢字換掉比較難
還不一定能保證找到的庫是能完美支援解析的

但如果是在純文字搜尋這點上的話 就比較簡單實現 只需要注意 escape 就可以了
只要在搜尋時 內部轉換成 regex 就可以

@LiMinggang LiMinggang self-assigned this Jul 10, 2019
@LiMinggang
Copy link
Owner

能说说这个的主要应用场景(user scenario)吗?

@bluelovers
Copy link
Author

bluelovers commented Jul 10, 2019

在繁簡混雜的環境下 要搜尋字詞比較方便

也能便利的搜尋並且修正異體字
有不少字都是肉眼看不出來差異的

但會因此導致搜不到內容

LiMinggang pushed a commit that referenced this issue Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants