All Projects → ringsaturn → DEVONthink-Chinese-Search

ringsaturn / DEVONthink-Chinese-Search

Licence: MIT license
部分解决 DEVONthink 搜索问题

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to DEVONthink-Chinese-Search

zazu
🚀 A fully extensible and open source launcher for hackers, creators and dabblers.
Stars: ✭ 2,078 (+9345.45%)
Mutual labels:  alfred
alfred-currency-conversion
Alfred 4 Workflow - See foreign exchange rates and currency conversion
Stars: ✭ 149 (+577.27%)
Mutual labels:  alfred
alfred-duden
Search the duden.de German dictionary from Alfred. With auto-suggest.
Stars: ✭ 32 (+45.45%)
Mutual labels:  alfred
alfred-string-operations
Perform string operations to clipboard content
Stars: ✭ 70 (+218.18%)
Mutual labels:  alfred
alfred-sublime-text
Filter and open your Sublime Text (2 and 3) project files from Alfred.
Stars: ✭ 66 (+200%)
Mutual labels:  alfred
alfred-otter
Alfred workflow for searching and retrieving transcripts from Otter.ai
Stars: ✭ 20 (-9.09%)
Mutual labels:  alfred
alfred-hugo
Alfred workflow bindings for NodeJS
Stars: ✭ 17 (-22.73%)
Mutual labels:  alfred
Wox
Launcher for Windows, an alternative to Alfred and Launchy.
Stars: ✭ 158 (+618.18%)
Mutual labels:  alfred
sux
An alternative to Alfred+Wox+Listary+OneQuick+CapslockPlus.一个只有2M+大小的强大效率工具
Stars: ✭ 47 (+113.64%)
Mutual labels:  alfred
shimmering-obsidian
Alfred Workflow for various enhancements of Obsidian.
Stars: ✭ 302 (+1272.73%)
Mutual labels:  alfred
alfred
A fast, simple way to make Alfred workflow script filters in Go
Stars: ✭ 25 (+13.64%)
Mutual labels:  alfred
alfred-git-commit-message-example
Alfred Git Commit Message Example
Stars: ✭ 55 (+150%)
Mutual labels:  alfred
alfred-kat
KAT workflow for Alfred, search and open magnet links directly from Alfred.
Stars: ✭ 16 (-27.27%)
Mutual labels:  alfred
bookends-tools
Alfred Workflow to Integrate with Bookends, an academic reference manager/bibliography tool for macOS
Stars: ✭ 78 (+254.55%)
Mutual labels:  alfred
Movie-and-TV-Show-Search-Alfred-Workflow
An Alfred workflow to search for a movie (or TV show) and get a few ratings
Stars: ✭ 63 (+186.36%)
Mutual labels:  alfred
AppleScriptive
Functional AppleScripts operating out of Keyboard Maestro, Alfred and Automator to optimise productivity.
Stars: ✭ 44 (+100%)
Mutual labels:  alfred
alfred-craftdocs-searchindex
Note searching for Craft Docs
Stars: ✭ 20 (-9.09%)
Mutual labels:  alfred
Alfred ShadowsocksController
ShadowsocksX controller for Alfred
Stars: ✭ 70 (+218.18%)
Mutual labels:  alfred
alfred-timer-workflow
Alfred workflow to start a timer, which blinks when the time is up.
Stars: ✭ 39 (+77.27%)
Mutual labels:  alfred
alfred-powerthesaurus
Search Powerthesaurus synonyms and antonyms from Alfred
Stars: ✭ 81 (+268.18%)
Mutual labels:  alfred

DEVONthink 中文索引生成程序

因为有了非常优雅的解决方案,这个项目短期内不会再更新了

还请使用这个 Alfred Workflow: https://github.com/mpco/AlfredWorkflow-DEVONthink-Search

@ringsaturn

2018-11-30


使用须知

这个方法并不能解决 DEVONthink 面对中文文本时孱弱的语义理解能力,只能做到改善 DEVONthink 的索引能力

  • 更加优雅的 macOS 上的解决方式参见 DEVONthink search
  • 如果希望 DEVONthink To Go 客户端上也有比较完整的索引,可以通过本脚本在 macOS 上得到关键词,同步到移动设备后供 To Go 索引
  • 本脚本提供的方法比较笨重,在此提供一个在 iOS 上的轻巧的替代方法:用 JSBox 的分词功能
  • 如果上述的替代的方法都不能满足您的要求,那么可以试试本脚本

原理

一句话解释:调用结巴分词从文本中提取关键词,并手动把关键词填入 Comments 中,供 DEVONthink 索引 结巴分词详情:fxsjy/jieba: 结巴中文分词

具体解释如下: DEVONthink 的索引文件是一个个形如 ......-126376F59F4F.dtp2 的文件,其中包含了文件的元数据与可供索引的信息。由于 DEVONthink 不支持对中文等非拉丁语言进行分词,所以无法直接搜索关键词。对于 DEVONthink 而言,每一句话(前后是标点符号的即分割为一句话)就是一个单词,这对于中文肯定是不行的。我知道有一种变通的方法通过用 * 来分开每隔汉字,从而获得较好的搜索结果体验。这种方法带来的问题是,搜索起来太不直观了。解决方法就是尽可能完善相应项目的 Spotlight Comments,把可供 DEVONthink 索引的词填入进去即可。这也正是这个程序的目的,生成搜索关键词

  • 默认关键词都是名词
  • 计算相邻的两个词权重下降幅度即斜率是否小于阈值

用法

  • 初始化后台服务: 运行一个小型服务器,提供基于结巴分词的关键词提取 API
  • 复制笔记内容
  • 前台调用 API 并把结果返回到剪贴板
  • 在相应笔记的 Spotlight Comments 处粘贴剪贴板内容(可以通过 Command+Shift+I 打开)

需要注意的是,程序默认提取的关键词都是名词,如果有别的需要,则需要修改对应部分的词性

安装及准备工作

准备后台服务

所有路径均默认在用户的根目录下

git clone https://github.com/ringsaturn/DEVONthink-Chinese-Search

cd DEVONthink-Chinese-Search

# 安装依赖
pip3 install -r requirements.txt

# 启动服务器
# 默认使用 5050 端口
# 重启/注销后需要再次执行这个命令
screen python3 AnalyzeKeyWordsAPI/Server.py

准备前台服务 Alfred Workflow

推荐使用 get keywords 后台模式.alfredworkflow

其他

  • 如果想提建议,发 issues 即可
  • 如果向帮助改进/增加其他的入口,还请移步 CONTRIBUTING 了解具体的参数
  • 也欢迎发邮件 [email protected]

待完成

  • 简化安装工作

重要更新记录

2018-01-31 更新 2.0

实现了一个简单的 POST 接口,通过后台运行一个小型服务器,大幅降低提取关键词耗时(主要是结巴分词初始化耗时)


2018-01-31 晚间更新 2.1

利用 shell 脚本和 cURL 实现了一个更好的获取请求速度


2018-02-01 更新 2.2

增加一个后台功能,在后台读取剪贴板内容并把关键词粘贴回剪贴板


2018-02-21 更新 2.3b

测试功能,2.3 中已取消

从 2.3b 开始,提取关键词流程做了改变

  • 输入文本整体进行分词并标注词性
  • 过滤出名词词性
  • 搜索引擎模式再分词

做出这个改变的原因是,在测试中发现结巴分词的提取关键词功能是基于词频的,语义上重要的词语并没有提取出来,故不进行根据权重的提取,试图用搜索引擎模式提高召回率

更新后的效果还有待观察。


2018-03-01 更新 2.3

  • 移除搜索引擎模式
    • 如果有一天找到了直接修改 DEVONthink 索引文件的方法就直接修改索引文件了
    • Spotlight Comments 应当留给自己做一些备忘性质的记录。使用搜索引擎模式太乱了
  • 修复词性过滤问题,默认过滤出:
    • nr 人名
    • ns 地名
    • nt 机构团体
    • nz 其他专名

参考:词性简介参见 jieba(结巴)分词种词性简介

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].