直接看项目视频演示:
bert 命名实体识别、关系抽取、人物抽取、地址解析、人名电话地址提取系统-完整代码数据_哔哩哔哩_bilibili
项目演示:
代码:
import re
from transformers import BertTokenizer, BertForTokenClassification, pipeline
import os
import torch
import re
from transformers import AutoTokenizer, AutoModelForTokenClassification
from seqeval.metrics.sequence_labeling import get_entities
# 加载中文分词器和模型
# Ensure no conflicts with parallel processing
o