22 个版本 (5 个稳定版)
2.0.0 | 2024 年 3 月 17 日 |
---|---|
1.1.2 | 2024 年 3 月 2 日 |
1.1.1 | 2024 年 1 月 25 日 |
0.9.1 | 2023 年 9 月 5 日 |
0.3.1 | 2023 年 3 月 5 日 |
#98 in 机器学习
230KB
3.5K SLoC
bkmr
超快速书签管理器和启动器
新功能:语义搜索(AI 嵌入)
特性
- 使用 OpenAI 嵌入进行语义搜索(需要 OpenAI API 密钥)
- 语义排名的全文搜索(FTS5)
- 模糊搜索
--fzf
(CTRL-O:复制到剪贴板,CTRL-E:编辑,CTRL-D:删除,Enter:打开) - 标签用于分类
- 可以处理 HTTP URL、目录、文件(例如 Office、图片、...)
- 可以通过协议前缀 'shell::' 将 URI 字符串作为 shell 命令执行:URI 示例:
shell::vim +/"## SqlAlchemy" $HOME/document.md
- 自动从 Web 中丰富 URL 的标题和描述
- 管理书签使用统计信息
bkmr search --fzf
是快速打开书签的好方法。
使用方法
bkmr --help
A Bookmark Manager and Launcher for the Terminal
Usage: bkmr [OPTIONS] [NAME] [COMMAND]
Commands:
search Searches Bookmarks
sem-search Semantic Search with OpenAI
open Open/launch bookmarks
add Add a bookmark
delete Delete bookmarks
update Update bookmarks
edit Edit bookmarks
show Show Bookmarks (list of ids, separated by comma, no blanks)
surprise Opens n random URLs
tags Tag for which related tags should be shown. No input: all tags are printed
create-db Initialize bookmark database
backfill Backfill embeddings for bookmarks
load-texts Load texts for semantic similarity search
help Print this message or the help of the given subcommand(s)
Arguments:
[NAME] Optional name to operate on
示例
# FTS examples (https://www.sqlite.org/fts5.htm)
bkmr search '"https://securit" *'
bkmr search 'security NOT keycloak'
# FTS combined with tag filtering
bkmr search -t tag1,tag2 -n notag1 <searchquery>
# Search by any tag and sort by bookmark age ascending
bkmr search -T tag1,tag2 -O
# Give me the 10 oldest bookmarks
bkmr search -O --limit 10
# Adding URI to local files
bkmr add /home/user/presentation.pptx tag1,tag2 --title 'My super Presentation'
# Adding shell commands as URI
bkmr add "shell::vim +/'# SqlAlchemy' sql.md" shell,sql,doc --title 'sqlalchemy snippets'
# JSON dump of entire database
bkmr search --json
# Semantic Search based on OpenAI Embeddings
bkmr --openai sem-search "python security" # requires OPENAI_API_KEY
标签必须由逗号分隔,不能有空格。
安装
cargo安装 bkmr
- 初始化数据库:
bkmr create-db db_path
export "BKMR_DB_URL=db-path"
,必须知道创建的 sqlite 数据库的位置- 添加 URL
更多配置选项可以在 文档页面 找到。
升级到 1.x.x
在新版本首次运行时将执行数据库迁移。这将向书签表添加两个用于 OpenAI 嵌入的列。不会对数据库进行破坏性更改。
语义搜索
bkmr
现在提供使用 OpenAI 嵌入的通用书签的完整语义搜索。
您可以在文档页面上找到更多信息。
基准测试
- 在Python预热后,比Python原始的twbm快约20倍。
time twbm search 'zzz*' --np
0. zzzeek : Asynchronous Python and Databases [343]
https://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/
async, knowhow, py
Found: 1
343
real 0m0.501s
user 0m0.268s
sys 0m0.070s
time bkmr search 'zzz*' --np
1. zzzeek : Asynchronous Python and Databases [343]
https://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/
async knowhow py
real 0m0.027s
user 0m0.008s
sys 0m0.016s
依赖项
~52–73MB
~1.5M SLoC