介绍
# Baidu Baike
从百度百科查询百科词条。
## 两种使用场景
### 场景 1:直接搜索
获取关键词的默认匹配词条。 ```bash python3 scripts/baidu_baike.py --search_type=lemmaTitle --search_key="keyword" ```
### 场景 2:同名消歧
当词条有多个含义时,列出它们并通过 ID 进行选择。 ```bash # List entries with same name python3 scripts/baidu_baike.py --search_type=lemmaList --search_key="keyword" --top_k=5
# Get specific entry by ID python3 scripts/baidu_baike.py --search_type=lemmaId --search_key="entry_id" ```
## API
- LemmaList:列出具有相同标题的词条 - LemmaContent:通过标题或 ID 获取词条详情
## 配置 ```bash export BAIDU_API_KEY="your_api_key" ```
## 工作流
1. 从查询中提取名词 2. 对于歧义词,先调用 LemmaList 3. 用户从列表中选择词条 4. 使用所选 ID 调用 LemmaContent 5. 返回结构化数据