先调用函数把这网下载的endnote转成,名为论文.excel
然后逐行读取,把excel的‘摘要’列和自定义一个的一个包含两列的excel,名为 提示词配置.excel,其中l‘提示词’列拼接发送给大模型接口,另一列是“标题”列
,把返回结果追加到 论文.excel 的最前面几列,列名为提示词配置.excel的‘标题列’,值为大模型返回结果。
也就是 提示词配置.excel有几行,就添加几列。
第一步 Refworks转excel
下载以后是个txt文件,
帮我把这个txt文件转excel,用函数形式来写便于我后期整理成软件
提取 其中的 标题,作者,单位,关键词,摘要。
分别存入excel列。
import re
import pandas as pd
def extract_and_convert(txt_file_path, output_excel_path):
with open(txt_file_path, 'r', encoding='utf-8') as file:
content = file.read()
# Regular expression patterns for each section
patterns = {
"标题": r"T1\s+(.+?)\n",
"作者": r"A1\s