from pprint import pprint
from paddlenlp import Taskflow
# 获取支持的任务列表
schema = ['父子', '夫妻', '母子','姐妹','姐弟','叔侄','祖孙','朋友','兄弟','兄长','妯娌','连襟'] # Define the schema for entity extraction
ie = Taskflow('information_extraction',
schema= schema,
schema_lang="zh",
batch_size=1,
model='paddlenlp/PP-UIE-0.5B',
precision='float32')
# 读取整个文件为字符串
# with open('d:\\15681.txt', 'r', encoding='utf-8') as file:
# content = file.read()
# print(content)
pprint(ie("张伟是李芳的丈夫,他们的儿子张小明和李芳的弟弟李强是叔侄关系。")) # Better print results using pprint
注意:本文归作者所有,未经作者允许,不得转载