Objective: # 概念阐释 GPT可以结合上下文给出推理的结果。 #### 情感分析: 根据内容判断内容中的情绪表达是积极的还是消极的。 1. 产品评论的情感是什么? 2. 产品评论的情感是什么?用一个单词,正面/负面 3. 可将原文中的情感总结成一些关键词:识别以下评论的作者表达的情感列表。列表中不超过五个项目。将您的答案格式化为由逗号分隔的小写单词列表。 4. 以下评论的作者是否表达了愤怒?请回答是或否。 #### 提取产品和公司名称 1. 请从评论文本中**识别**以下内容: •评论者购买的物品 •制造该物品的公司 2. 识别多种任务: •情感(正面或负面) •是否表达愤怒(真或假) •被评论者购买的产品 •制造该物品的公司 •制作JSON文件 3. 提取主题/话题 •确定以下由三个反引号分隔的文本中正在讨论的五个主题。每个项目只需用一两个单词。将您的响应格式化为由逗号分隔的项目列表。 •提取关键词 •提出引发思考的好问题 # 实例 #### 情感分析 ``` 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!! ``` Prompt1: ``` What is the sentiment of the following product review, which is delimited with triple backticks? 产品评论的情感是什么? ``` Prompt2: ``` What is the sentiment of the following product review, which is delimited with triple backticks? Give your answer as a single word, either "positive" \ or "negative". 产品评论的情感是什么?用一个单词,正面/负面 ``` Prompt3: ``` Identify a list of emotions that the writer of the \ following review is expressing. Include no more than \ five items in the list. Format your answer as a list of \ lower-case words separated by commas. 识别以下评论的作者表达的情感列表。列表中不超过五个项目。将您的答案格式化为由逗号分隔的小写单词列表。 结果: happy, satisfied, grateful, impressed, content ``` Prompt4: ``` Is the writer of the following review expressing anger?\ The review is delimited with triple backticks. \ Give your answer as either yes or no. 以下评论的作者是否表达了愤怒? 这篇评论用三个反引号限定了范围。 请回答是或否。 ``` #### 提取产品和公司名称 ``` Identify the following items from the review text: - Item purchased by reviewer - Company that made the item The review is delimited with triple backticks. \ Format your response as a JSON object with \ "Item" and "Brand" as the keys. If the information isn't present, use "unknown" \ as the value. Make your response as short as possible. 请从评论文本中识别以下内容: - 评论者购买的物品 - 制造该物品的公司 评论文本使用三个反引号分隔。 将您的响应格式化为JSON对象,键为“Item”和“Brand”。 如果信息不存在,请使用“unknown”作为值。 尽可能简洁地回答。 结果: { "Item": "lamp", "Brand": "Lumina" } ``` #### 一次执行多任务 ``` Identify the following items from the review text: 请从评论文本中识别以下内容: - Sentiment (positive or negative)情感(正面或负面) - Is the reviewer expressing anger? (true or false)是否表达愤怒(真或假) - Item purchased by reviewer(被评论者购买的产品) - Company that made the item(制造该物品的公司) 告诉GPT要一个怎样的JSON格式文件 The review is delimited with triple backticks. \ Format your response as a JSON object with \ "Sentiment", "Anger", "Item" and "Brand" as the keys. If the information isn't present, use "unknown" \ as the value. Make your response as short as possible. Format the Anger value as a boolean. ``` #### 提取话题 ``` Determine five topics that are being discussed in the \ following text, which is delimited by triple backticks. Make each item one or two words long. Format your response as a list of items separated by commas. 确定以下由三个反引号分隔的文本中正在讨论的五个主题。 每个项目只需用一两个单词。 将您的响应格式化为由逗号分隔的项目列表。 结果: government survey, job satisfaction, NASA, Social Security Administration, employee concerns 政府调查、工作满意度、NASA、社会保障管理局、员工关注。 ``` #### 话题列表? topic_list给出的话题是否都存在于story,这里的topic词不是完全对应,也就是说GPT可以推断出哪些相关,哪些无关。 ``` Make a news alert for certain topics topic_list = [ "nasa", "local government", "engineering", "employee satisfaction", "federal government" ] Determine whether each item in the following list of topics is a topic in the text below, which is delimited with triple backticks.Give your answer as list with 0 or 1 for each topic. 为特定主题设置新闻提醒。确定以下主题列表中的每个项目是否是以下用三个反引号分隔的文本中的主题。以每个主题的0或1列表形式给出您的答案。 结果: nasa: 1 //NASA local government: 0 engineering: 0 employee satisfaction: 1 //job satisfaction federal government: 1 //government survey ``` 如果nasa为`true`,print` ALERT: New NASA story!`(这一步没看懂???) ``` topic_dict = {i.split(': ')[0]: int(i.split(': ')[1]) for i in response.split(sep='\n')} if topic_dict['nasa'] == 1: print("ALERT: New NASA story!") ``` # 相关内容 # 参考资料