吴恩达 ChatGPT Prompt Engineering for Developers 系列课程笔记--05 Inferring

05 Inferring

本节主要介绍inferring(文本推理)任务,可以视为对输入文本的理解和分析任务,包含文本分类、理解情感等。

1) 简单的分类任务

给定一段关于灯的评论

lamp_review = """
Needed a nice lamp for my bedroom, and this one had \
additional storage and not too high of a price point. \
Got it fast.  The string to our lamp broke during the \
transit and the company happily sent over a new one. \
Came within a few days as well. It was easy to put \
together.  I had a missing part, so I contacted their \
support and they very quickly got me the missing piece! \
Lumina seems to me to be a great company that cares \
about their customers and products!!
"""
response = get_completion(prompt)
print(response)

现在我们要模型给出该段评论的情感,我们可以使用下述prompt输入模型。

`prompt = f"""
What is the sentiment of the following product review, 
which is delimited with triple backticks?

Review text: '''{
     lamp_review}'''
"""

模型会得到"The sentiment of the product review is positive"。如果我们只想得到一个情感分类,方便后续处理,我们可以直接将希望得到的分类标签规定在prompt中:

`prompt =
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值