Token Classification
Transformers
PyTorch
Chinese
named-entity-recognition
ner
ernie
crf
chinese-nlp
person-name-extraction
financial-documents
Instructions to use warfbro/Human-Name-extraction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use warfbro/Human-Name-extraction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="warfbro/Human-Name-extraction")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("warfbro/Human-Name-extraction", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 520 Bytes
60c038b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """规则提取(简单模板)"""
import re
def extract(title: str):
"""
模板: 关于[核准|同意][人名]、[人名]...任职
返回 [names] 或 None
"""
m = re.match(r"关于(?:核准|同意)?(.+?)任职", title)
if not m:
return None
name_part = m.group(1)
# 按顿号分隔多人
if "、" in name_part:
names = [n.strip() for n in name_part.split("、") if n.strip()]
return names if names else None
return [name_part]
|