场景介绍
锦上添花下的第二大的场景是信息解释。它跟改写内容有点像,但又不太一样,信息解释有可能提供超过原文内容的信息。
举几个信息解释的例子,大家应该就能理解了:
- 解释代码:比如你看到一段 python 的代码,但你看不懂,你可以让 ai 解释下代码的含义。
- 解释论文:看某篇论文看不懂,或者论文里的某一段看不懂,你也可以让 ai 解释。
以解释代码为例,它的 prompt 是这样的(此案例来自 openai ):
explanation of what the code does:
python 3
def remove_common_prefix(x, prefix, ws_prefix):
x["completion"] = x["completion"].str[len(prefix) :]
if ws_prefix:
# keep the single whitespace as prefix
x["completion"] = " " x["completion"]
return x
以下是 chatgpt 的 output,它阐述了这段代码是拿来干什么的,同时还阐述了各个参数的含义:
this is a python function called remove_common_prefix that takes in three parameters: x, prefix, and ws_prefix.
the x parameter is assumed to be a pandas dataframe or series object with a column named "completion", which contains strings that may or may not start with the prefix string.
the prefix parameter is a string that represents the common prefix that needs to be removed from the beginning of each string in the "completion" column of the dataframe.
the ws_prefix parameter is a boolean value that indicates whether or not to keep a single whitespace character as a prefix after the common prefix has been removed.
the function modifies the "completion" column of the dataframe by removing the prefix string from the beginning of each string in that column using the pandas str method and string slicing. the len(prefix) : syntax is used to slice the string starting from the character that follows the prefix.
if ws_prefix is true, then the function adds a single whitespace character as a prefix to each string in the "completion" column after removing the prefix.
finally, the modified dataframe is returned by the function.
未经允许不得转载:尊龙游戏旗舰厅官网 » chatgpt场景6:锦上添花——信息解释