File size: 708 Bytes
5c86bf0
0ab665d
 
5c86bf0
0ab665d
5c86bf0
 
0ab665d
 
5c86bf0
0ab665d
5c86bf0
 
 
0ab665d
5c86bf0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""R27 多游戏抽取示例:下载仓库后执行 python example.py。"""
import json
import sys
from pathlib import Path

root = Path(__file__).resolve().parent
sys.path.insert(0, str(root / "sdk"))
from extraction_sdk import SemanticUnitExtractor

extractor = SemanticUnitExtractor(str(root / "model"), dtype="bf16")
records = [
    {"id": "demo-001", "text": "孙悟空打野", "game_name": "王者荣耀"},
    {"id": "demo-002", "text": "原神抽卡,原神更新后卡顿", "game_name": "原神"},
    {"id": "demo-003", "text": "和平精英组队排位", "game_name": "和平精英"},
]
for result in extractor.extract_batch(records):
    print(json.dumps(result, ensure_ascii=False, indent=2))