摘要 1: “This study explores the effects of soil microbiomes on plant growth in maize, focusing on nitrogen fixation and plant health under different environmental conditions.”
摘要 2: “The research investigates the impact of synthetic microbial communities on soil nutrient cycling, analyzing their potential to enhance agricultural sustainability.”
摘要 3: “This paper examines the interactions between soil microorganisms and plant roots, specifically in the context of drought resistance in crops.”
15.1.2 实施步骤
第一步:收集摘要
将这些摘要收集并整理好,可以按主题或关键字进行分类。
第二步:输入模型
假设你将这三个摘要分批输入模型,并让模型识别每个摘要的主要研究主题。你可以构造这样的提示:
提示词示例:
“请根据以下摘要识别每篇文章的主要研究主题:
摘要 1: [输入摘要]
摘要 2: [输入摘要]
摘要 3: [输入摘要]”
第三步:模型输出
模型将分析这些摘要,并识别出每篇文章的主题。例如,模型可能给出的结果如下:
摘要 1 主题: 植物健康与氮固定在不同环境条件下的变化
摘要 2 主题: 微生物群落在土壤养分循环中的作用及其对农业可持续性的影响
摘要 3 主题: 土壤微生物与作物抗旱性之间的相互作用
15.2 代码实现
要实现这个过程,你可以使用 Python 结合 OpenAI 的 API 来处理文本。以下是一个代码示例,利用 GPT 模型分析摘要并提取主要主题。
import openaiimport osfrom IPython.display import Markdownopenai.base_url ="https://api.chatanywhere.tech"openai.api_key = os.getenv("CHATANYWHERE_API_KEY")system_prompt ="这些文章的主题是什么?"def analyze_abstracts(abstracts):# Create prompt with multiple messages (abstracts) messages = [ {"role": "system", "content": system_prompt} ]for abstract in abstracts: messages.append({"role": "user", "content": abstract})# Use Completion.create with messages list response = openai.chat.completions.create( model="gpt-4o-ca", # Adjust model as needed messages=messages, n=1, # Generate only 1 response )# Extract and return the analyzed contentreturn response.choices[0].message.content# 示例摘要abstracts = ["Paper1: This study explores the effects of soil microbiomes on plant growth in maize, focusing on nitrogen fixation and plant health under different environmental conditions.","Paper2: The research investigates the impact of synthetic microbial communities on soil nutrient cycling, analyzing their potential to enhance agricultural sustainability.","Paper3: This paper examines the interactions between soil microorganisms and plant roots, specifically in the context of drought resistance in crops."]# 分析摘要并输出主题themes = analyze_abstracts(abstracts)Markdown(themes)
这些文章的主题如下:
Paper 1: 研究土壤微生物群对玉米植物生长的影响,重点关注在不同环境条件下的固氮作用和植物健康。
PT AU BA CA GP \
0 J Just, Berta Singla; Marks, Evan Alexander Neth... NaN NaN NaN
1 J Pereira-Marques, Joana; Ferreira, Rui M.; Figu... NaN NaN NaN
2 J Golzar-Ahmadi, Mehdi; Bahaloo-Horeh, Nazanin; ... NaN NaN NaN
3 J Li, Chenglong; Han, Yanfeng; Zou, Xiao; Zhang,... NaN NaN NaN
4 J Hu, Yu; Wang, Yulin; Wang, Runhua; Wang, Xiaok... NaN NaN NaN
TI \
0 Biofertilization increases soil organic carbon...
1 A metatranscriptomics strategy for efficient c...
2 Pathway to industrial application of heterotro...
3 A systematic discussion and comparison of the ...
4 Dirammox-dominated microbial community for bio...
SO VL IS BP ... \
0 INTERNATIONAL JOURNAL OF AGRICULTURAL SUSTAINA... 22 1 NaN ...
1 GUT MICROBES 16 1 NaN ...
2 BIOTECHNOLOGY ADVANCES 77 NaN NaN ...
3 SYNTHETIC AND SYSTEMS BIOTECHNOLOGY 9 4 775 ...
4 APPLIED MICROBIOLOGY AND BIOTECHNOLOGY 108 1 NaN ...
PY AB \
0 2024 Protecting and building soil carbon has become...
1 2024 The high background of host RNA poses a major ...
2 2024 The transition to renewable energies and elect...
3 2024 Synthetic microbial community has widely conce...
4 2024 Direct ammonia oxidation (Dirammox) might be o...
C1 CT CY SP CL TC \
0 [Just, Berta Singla; Llenas, Laia; Ponsa, Serg... NaN NaN NaN NaN 0
1 [Pereira-Marques, Joana; Ferreira, Rui M.; Fig... NaN NaN NaN NaN 2
2 [Golzar-Ahmadi, Mehdi; Norouzi, Forough; Holus... NaN NaN NaN NaN 0
3 [Li, Chenglong; Han, Yanfeng; Zou, Xiao; Zhang... NaN NaN NaN NaN 0
4 [Hu, Yu; Wang, Yulin; Liu, Shuang-Jiang] Shand... NaN NaN NaN NaN 0
WC UT
0 Agriculture, Multidisciplinary; Green & Sustai... WOS:001247571700001
1 Gastroenterology & Hepatology; Microbiology WOS:001176335800001
2 Biotechnology & Applied Microbiology WOS:001316252000001
3 Biotechnology & Applied Microbiology WOS:001273513000001
4 Biotechnology & Applied Microbiology WOS:001252334300001
[5 rows x 24 columns]