xberg-extracting-keywords
它能做什么
这项技能说明如何使用 YAKE 或 RAKE 方法从文档中获取关键词,以及如何检测文档的语言。适合需要快速主题标签或语言检查的人。
适用场景
- ✓当你想从报告或论文中获取主要主题或关键词时。
- ✓当你需要知道某份文档使用的是哪种语言时。
- ✓当你在构建搜索,需要根据文档生成向量嵌入时。
技能链接
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-keywords/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请从这篇研究论文中提取主要关键词,并告诉我它使用的是哪种语言。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在提取选项中开启关键词设置,并选择 YAKE 或 RAKE。关键词随后会出现在结果中。嵌入则通过单独的 embed 命令生成。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Extracting keywords, language, and embeddings
Use this for the enrichment surface around extraction: statistical keyword
extraction, language detection, and vector embeddings. Keywords and
language detection ride along with extraction and land on the result;
embeddings are produced by a dedicated embed command.
Keywords (YAKE / RAKE)
Keyword extraction is configured via the [keywords] config block (or
inline JSON) — there is no single --keywords CLI flag. When enabled,
extracted keywords appear on result.extracted_keywords (extractedKeywords
in Node.js; the CLI JSON field is extracted_keywords). Two algorithms are
available:
- YAKE (
"yake") — statistical, unsupervised single-document extraction. Good general default. - RAKE (
"rake") — co-occurrence / phrase-based. Favors multi-word key phrases.
Feature-gated: keyword extraction requires the CLI to be built with the
keywords-yakeand/orkeywords-rakeCargo features (both are in the default/fullbuild). If the CLI was built without them, the[keywords]config block is silently ignored —result.extracted_keywordssimply stays empty rather than erroring. The"yake"algorithm needskeywords-yake;"rake"needskeywords-rake.
Enable via inline JSON on the CLI:
xberg extract paper.pdf --format json \
--config-json '{"keywords":{"algorithm":"yake","max_keywords":15,"language":"en"}}' \
| jq '.result.extracted_keywords'
Or in a config file:
[keywords]
algorithm = "rake" # "yake" or "rake"
max_keywords = 10 # default 10
min_score = 0.0 # filter below this score (normalized 0.0-1.0 for both algorithms)
ngram_range = [1, 3] # unigrams..trigrams (default); config-file only
language = "en" # stopword language; omit to skip stopword filtering
xberg extract report.pdf --config xberg.toml --format json | jq '.result.extracted_keywords'
Field notes:
max_keywordscaps how many keywords are returned (default 10).min_scorefilters low-scoring keywords. Both YAKE and RAKE normalize their scores to the0.0-1.0range with higher-is-better, somin_scoreretains keywords withscore >= min_scoreidentically for either algorithm.ngram_rangeis[min, max]:[1,1]unigrams only,[1,2]adds bigrams,[1,3](default) adds trigrams. Config-file only — it is not a field on the language bindings'KeywordConfig.languageenables stopword filtering for that language; omit it to disable stopword filtering entirely.
Language detection
Language detection is a real CLI flag: --detect-language. Detected
languages appear on result.detected_languages:
xberg extract multilingual.pdf --detect-language true --format json \
| jq '.result.detected_languages'
In a config file it lives under [language_detection]:
[language_detection]
enabled = true
min_confidence = 0.8
detect_multiple = false
The CLI flag enables detection with min_confidence = 0.8 and
single-language mode; use the config block to detect multiple languages or
tune confidence.
Embeddings (embed command)
The standalone embed command produces vector embeddings for text from
--text (repeatable) or stdin. It does not run extraction — pipe
extracted content in if you want document embeddings.
# Local ONNX preset model (default provider)
xberg embed --text "first passage" --text "second passage" --preset balanced
# Embed extracted document text
xberg extract report.pdf | xberg embed --preset quality
Presets for the local provider: fast, balanced (default), quality,
multilingual. Output defaults to JSON (--format json).
--provider selects the embedding source:
| Provider | Flag | Notes |
|---|---|---|
local |
--preset <fast|balanced|quality|multilingual> |
Default. ONNX model, no API key. |
llm |
--model <id> --api-key <key> |
liter-llm routing, e.g. openai/text-embedding-3-small. |
plugin |
--plugin <name> |
A backend pre-registered in-process via the plugin API. |
# Provider-hosted embeddings via an LLM
xberg embed --text "query text" \
--provider llm --model openai/text-embedding-3-small --api-key "$OPENAI_API_KEY"
Local embedding presets must be down
常见问题
YAKE 和 RAKE 有什么区别?
YAKE 是一种统计方法,作为通用默认选择效果较好;RAKE 则更偏向多词关键短语。
为什么我的关键词没有出现?
关键词功能必须已内置在该工具中。如果没有,设置会被忽略,列表会保持为空,且不会报错。
嵌入是在哪里生成的?
由专门的 embed 命令生成,与普通提取分开进行。
详情
作者的原始描述
Use when extracting keywords (YAKE/RAKE) from documents — and, secondarily, when detecting document language or generating embeddings for RAG and search. Covers the keyword config (and its feature gating), `--detect-language`, and the standalone `embed` command with real flags.
repo: xberg-io/xberg
热度
- GitHub 星标
- 9.5k
- 排名
- #12270
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
xberg-batch-extraction
9.5k帮你的智能体使用 Xberg 一次处理大量文档,共用一组选项,限制并行工作量,并让失败的文件不会中断整个任务。
xberg-chunking
9.5k帮你的智能体把长文档文字切分为较小的片段,用于 AI 提示或搜索索引,可设置大小并可选择重叠部分。
xberg-extracting-tables
9.5k帮你的智能体从 PDF、电子表格和图片中提取表格,并以 Markdown 或结构化数据的形式保持行和列的完整。
xberg-extracting-with-ocr
9.5k帮你的智能体使用 OCR 从没有文字层的扫描 PDF、照片和图片中读取文字,并可选择语言包。