Paddle 一键预测
https://github.com/PaddlePaddle/PaddleNLP
PaddleNLP提供一键预测功能,无需训练,直接输入数据即可开放域抽取结果:
from pprint import pprint from paddlenlp import Taskflow schema = ['时间', '选手', '赛事名称'] ie = Taskflow('information_extraction', schema=schema) txt ='2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!' txt=ie(txt) pprint(txt)
输出
[{'时间': [{'end': 6,
'probability': 0.9857378532473966,
'start': 0,
'text': '2月8日上午'}],
'赛事名称': [{'end': 23,
'probability': 0.8503081103003893,
'start': 6,
'text': '北京冬奥会自由式滑雪女子大跳台决赛'}],
'选手': [{'end': 31,
'probability': 0.8981535684051067,
'start': 28,
'text': '谷爱凌'}]}]
浙公网安备 33010602011771号