xberg
Skill này làm gì
Skill này giúp lập trình viên dùng thư viện Xberg để đọc tài liệu bằng Python, Node.js, Rust hoặc dòng lệnh. Nó dành cho người xây công cụ cần lấy văn bản hoặc dữ liệu bên trong tài liệu.
Khi nào nên dùng
- ✓Khi bạn viết code trích xuất văn bản từ PDF, file Word hoặc email.
- ✓Khi bạn cần chạy OCR trên các trang quét hoặc hình ảnh.
- ✓Khi bạn muốn xử lý nhiều tài liệu trong một batch với cùng một bộ cài đặt.
Liên kết skill
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Viết một script Python lấy văn bản và bảng từ tất cả các hóa đơn PDF của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent cài gói Xberg cho ngôn ngữ của bạn, chọn các tùy chọn bạn cần như OCR hoặc chia đoạn, rồi viết code trả về văn bản, bảng và metadata từ mỗi tài liệu.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Xberg Document Extraction
Xberg is a document intelligence library with a Rust core and bindings for Python, TypeScript/Node.js, Ruby, PHP, Go, Java, C#, Elixir, WebAssembly, Dart, Kotlin Android, Swift, Zig, and C. It extracts text, tables, metadata, and images from 107 formats across 140 unique file extensions and accepts 53 compatibility MIME aliases, including PDF, Office documents, images, HTML, email, archives, and academic formats.
Use this skill when writing code that:
- Extracts text or metadata from documents
- Performs OCR on scanned documents or images
- Batch-processes multiple files
- Configures extraction options (output format, chunking, OCR, language detection)
- Implements custom plugins (post-processors, validators, OCR backends)
If the
xbergMCP server is registered in this session, prefer its tools over shelling out to the CLI — they expose the same extraction surface with structured arguments and results.
Installation
Python
pip install xberg
Node.js
npm install @xberg-io/xberg
Rust
cargo add xberg
# Cargo.toml
[dependencies]
xberg = { version = "1.1.0", features = ["full"] }
tokio = { version = "1", features = ["full"] }
# feature flags: pdf, ocr, chunking, embeddings, language-detection, keywords, api, mcp
# (or "formats" / "full" aggregates); tokio-runtime is on by default
CLI
brew install xberg-io/tap/xberg
# or run without a persistent install (the CLI proxy package self-installs the binary):
npx @xberg-io/xberg-cli@1.3.10 --help
uvx --from xberg-cli==1.3.8 xberg --help
# or download a prebuilt binary from the latest GitHub release:
# https://github.com/xberg-io/xberg/releases/latest
# or build from source:
cargo install xberg-cli
Quick Start
The library entry points are extract(input, config) and extract_batch(inputs, config). Both return an ExtractionResult envelope — the extracted document(s) live in result.results, and per-document data (content, tables, metadata, …) is on each result.results[i]. Python and Node are async-only.
Python
import asyncio
from xberg import ExtractInput, extract, ExtractionConfig
async def main() -> None:
result = await extract(ExtractInput(uri="document.pdf"), ExtractionConfig())
doc = result.results[0]
print(doc.content) # extracted text
print(doc.metadata) # document metadata
print(doc.tables) # extracted tables
asyncio.run(main())
Node.js
import { extract } from "@xberg-io/xberg";
const output = await extract({ kind: "uri", uri: "document.pdf" });
const doc = output.results[0];
console.log(doc.content);
console.log(doc.metadata);
console.log(doc.tables);
Rust
use xberg::{extract, ExtractInput, ExtractionConfig};
#[tokio::main]
async fn main() -> xberg::Result<()> {
let output = extract(ExtractInput::from_uri("document.pdf"), &ExtractionConfig::default()).await?;
println!("{}", output.results[0].content);
Ok(())
}
CLI
xberg extract document.pdf
xberg extract document.pdf --format json
xberg extract document.pdf --content-format markdown
Configuration
All languages use the same configuration structure with language-appropriate naming conventions.
Python (snake_case)
from xberg import (
ExtractInput, extract,
ExtractionConfig, OcrConfig, TesseractConfig, PdfConfig, ChunkingConfig, OutputFormat,
)
config = ExtractionConfig(
ocr=OcrConfig(
backend="tesseract",
language=["eng"],
tesseract_config=TesseractConfig(psm=6, enable_table_detection=True),
),
pdf_options=PdfConfig(passwords=["secret123"]),
chunking=ChunkingConfig(max_characters=1000, overlap=200),
output_format=OutputFormat("markdown"),
)
result = await extract(ExtractInput(uri="document.pdf"), config)
Node.js (camelCase)
import { extract, type ExtractionConfig } from "@xberg-io/xberg";
const config: ExtractionConfig = {
ocr: { backend: "tesseract", language: ["eng"] },
pdfOptions: { passwords: ["secret123"] },
chunking: { maxCharacters: 1000, overlap: 200 },
outputFormat: "markdown",
};
const output = await extract({ kind: "uri", uri: "document.pdf" }, config);
Rust (snake_case)
use xberg::{extract, ExtractInput, ExtractionConfig, OcrConfig, ChunkingConfig, OutputFormat};
let config = ExtractionConfig {
ocr: Some
Câu hỏi thường gặp
Skill bao gồm những ngôn ngữ nào?
Skill bao gồm Python, Node.js và TypeScript, Rust và dòng lệnh, đồng thời liệt kê các binding ngôn ngữ khác.
Nó có đọc được tài liệu quét không?
Có. Nó có thể chạy OCR trên các trang và hình ảnh quét, và ép OCR khi PDF không có văn bản dùng được.
Có cần máy chủ riêng không?
Không. Skill dùng trực tiếp thư viện, dù nó ưu tiên các công cụ Xberg khi máy chủ đó đã được kết nối.
Chi tiết
Mô tả gốc của tác giả
Extract text, tables, metadata, and images from 107 document formats (PDF, Office, images, HTML, email, archives, academic) using Xberg. Use when writing code that calls Xberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins.
repo: xberg-io/xberg
Độ phổ biến
- Sao GitHub
- 9.5k
- Vị trí xếp hạng
- #12274
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
xberg-batch-extraction
9.5kGiúp agent của bạn xử lý nhiều tài liệu một lượt với Xberg, dùng chung tùy chọn, giới hạn việc song song và không để một file lỗi làm dừng cả lượt.
xberg-chunking
9.5kGiúp agent của bạn chia văn bản dài thành các đoạn nhỏ cho prompt AI hoặc chỉ mục tìm kiếm, với kích thước đặt sẵn và chồng lấp tùy chọn.
xberg-extracting-keywords
9.5kGiúp agent của bạn lấy các từ khóa chính hoặc cụm từ khóa từ tài liệu và nhận diện ngôn ngữ của tài liệu, bằng các cài đặt từ khóa của Xberg.
xberg-extracting-tables
9.5kGiúp agent của bạn lấy bảng từ PDF, bảng tính và hình ảnh, giữ nguyên hàng và cột dưới dạng markdown hoặc dữ liệu có cấu trúc.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.