v1.0.0
Imported from PrompterHub
Imported or synced from PrompterHub public prompt data.
2025-05-29 00:00基于"以上是一份聊天记录,如你所见除了部分无关聊天外,充斥着关于物流价格时效的问询,而我需要你帮我提取这些..."生成的专业提示词
来源:PrompterHub 公开社区镜像
原始链接:https://www.prompterhub.cn/p/112
PrompterHub ID:112
作者:匿名用户
分类:办公
标签:办公
导入时热度:浏览 1,点赞 0,评论 0
基于"以上是一份聊天记录,如你所见除了部分无关聊天外,充斥着关于物流价格时效的问询,而我需要你帮我提取这些..."生成的专业提示词
# 提取物流价格时效信息的JS代码
// 第一部分:基础数据提取函数
function extractLogisticsInfo(chatLog) {
const lines = chatLog.split('\n');
const results = [];
let currentEntry = {};
for (const line of lines) {
// 跳过空行和明显无关的消息
if (!line.trim() || line.includes('你好') || line.includes('谢谢') || line.includes('不客气')) {
continue;
}
// 匹配客服回复的价格信息 (示例模式)
const priceMatch = line.match(/(\d+\.?\d*)\s*(元|RMB|USD|¥)/);
// 匹配时效信息 (示例模式)
const timeMatch = line.match(/(\d+)\s*(天|小时|日|工作日)/);
// 匹配地点信息
const locationMatch = line.match(/(发往|到|至|from|to)\s*([\u4e00-\u9fa5A-Za-z]+)/);
// 匹配货物参数
const cargoMatch = line.match(/(\d+)\s*(plt|pcs|件|个|kg|公斤|立方|CBM)/i);
if (priceMatch) {
currentEntry.price = priceMatch[0];
}
if (timeMatch) {
currentEntry.deliveryTime = timeMatch[0];
}
if (locationMatch) {
currentEntry.destination = locationMatch[2];
}
if (cargoMatch) {
currentEntry.cargoParams = currentEntry.cargoParams || [];
currentEntry.cargoParams.push(cargoMatch[0]);
}
// 当检测到时间戳时,认为是新的一条记录开始
if (line.match(/\d+\/\d+\s+\d+:\d+:\d+/)) {
if (Object.keys(currentEntry).length > 0) {
results.push(currentEntry);
currentEntry = {};
}
}
}
// 添加最后一条记录
if (Object.keys(currentEntry).length > 0) {
results.push(currentEntry);
}
return results;
}
// 第二部分:时效分析增强函数
function analyzeDeliveryTime(chatLog) {
const timePattern = /(\d+\/\d+\s+\d+:\d+:\d+).*?(今天提|预计|交货|送达).*?(\d+\/\d+)/g;
const timeMatches = [...chatLog.matchAll(timePattern)];
const timeAnalysis = [];
for (const match of timeMatches) {
const startDate = new Date(match[1]);
const endDate = new Date(match[3]);
const days = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24));
timeAnalysis.push({
startDate: match[1],
endDate: match[3],
daysRequired: days
});
}
return timeAnalysis;
}
// 第三部分:主处理函数
function processChatLog(chatLog) {
const logisticsInfo = extractLogisticsInfo(chatLog);
const timeAnalysis = analyzeDeliveryTime(chatLog);
// 合并时效分析结果
logisticsInfo.forEach((entry, index) => {
if (timeAnalysis[index]) {
entry.actualDeliveryDays = timeAnalysis[index].daysRequired;
}
});
return logisticsInfo;
}
// 使用示例
// const cleanedData = processChatLog(yourChatLogText);
// console.log(cleanedData);
以上是一份聊天记录,如你所见除了部分无关聊天外,充斥着关于物流价格时效的问询,而我需要你帮我提取这些信息,我希望能做到如下几点:
1.剔除无关消息,仅保留斯比特客服回复的价格与时效以及每个报价对应的关键引用数据(出发地、目的地、体积重量参数等)
2.时效的判断可以通过聊天记录中的对话时间来分析,如“Mandy(黄非非)(Mandy(黄非非)) 5/17 13:52:52 今天提,21号交货”则为最多四天要送到,合理判断斯比特客服给的时效
3.记住物流单位在中英文里的缩写简写,如plt,pcs,件,个等,同时确保询价数据无遗漏
4.生成可以复制黏贴直接使用的js代码,方便我在以后也能一键剔除不相干数据
5.如果代码不能一次生成,请分段生成
6.不要花费token描述无关事情,给我的回答只需要是可复制粘贴使用的python代码即可
# 提取物流价格时效信息的JS代码
// 第一部分:基础数据提取函数
function extractLogisticsInfo(chatLog) {
const lines = chatLog.split('\n');
const results = [];
let currentEntry = {};
for (const line of lines) {
// 跳过空行和明显无关的消息
if (!line.trim() || line.includes('你好') || line.includes('谢谢') || line.includes('不客气')) {
continue;
}...# 提取物流价格时效信息的JS代码
// 第一部分:基础数据提取函数
function extractLogisticsInfo(chatLog) {
const lines = chatLog.split('\n');
const results = [];
let currentEntry = {};
for (const line of lines) {
// 跳过空行和明显无关的消息
if (!line.trim() || line.includes('你好') || line.includes('谢谢') || line.includes('不客气')) {
continue;
}
// 匹配客服回复的价格信息 (示例模式)
const priceMatch = line.match(/(\d+\.?\d*)\s*(元|RMB|USD|¥)/);
// 匹配时效信息 (示例模式)
const timeMatch = line.match(/(\d+)\s*(天|小时|日|工作日)/);
// 匹配地点信息
const locationMatch = line.match(/(发往|到|至|from|to)\s*([\u4e00-\u9fa5A-Za-z]+)/);
// 匹配货物参数
const cargoMatch = line.match(/(\d+)\s*(plt|pcs|件|个|kg|公斤|立方|CBM)/i);
if (priceMatch) {
currentEntry.price = priceMatch[0];
}
if (timeMatch) {
currentEntry.deliveryTime = timeMatch[0];
}
if (locationMatch) {
currentEntry.destination = locationMatch[2];
}
if (cargoMatch) {
currentEntry.cargoParams = currentEntry.cargoParams || [];
currentEntry.cargoParams.push(cargoMatch[0]);
}
// 当检测到时间戳时,认为是新的一条记录开始
if (line.match(/\d+\/\d+\s+\d+:\d+:\d+/)) {
if (Object.keys(currentEntry).length > 0) {
results.push(currentEntry);
currentEntry = {};
}
}
}
// 添加最后一条记录
if (Object.keys(currentEntry).length > 0) {
results.push(currentEntry);
}
return results;
}
// 第二部分:时效分析增强函数
function analyzeDeliveryTime(chatLog) {
const timePattern = /(\d+\/\d+\s+\d+:\d+:\d+).*?(今天提|预计|交货|送达).*?(\d+\/\d+)/g;
const timeMatches = [...chatLog.matchAll(timePattern)];
const timeAnalysis = [];
for (const match of timeMatches) {
const startDate = new Date(match[1]);
const endDate = new Date(match[3]);
const days = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24));
timeAnalysis.push({
startDate: match[1],
endDate: match[3],
daysRequired: days
});
}
return timeAnalysis;
}
// 第三部分:主处理函数
function processChatLog(chatLog) {
const logisticsInfo = extractLogisticsInfo(chatLog);
const timeAnalysis = analyzeDeliveryTime(chatLog);
// 合并时效分析结果
logisticsInfo.forEach((entry, index) => {
if (timeAnalysis[index]) {
entry.actualDeliveryDays = timeAnalysis[index].daysRequired;
}
});
return logisticsInfo;
}
// 使用示例
// const cleanedData = processChatLog(yourChatLogText);
// console.log(cleanedData);Source: https://www.prompterhub.cn/p/112 PrompterHub ID: 112 Author: 匿名用户 Category: 办公 Topics: 办公 Models: 通用提示词 PrompterHub metrics: views=1, likes=0, comments=0
请按照提示词正文中的目标、约束和输出格式生成结果。
Imported or synced from PrompterHub public prompt data.
2025-05-29 00:00