抱歉,我理解错误了您的问题。以下是包含路径的Shell脚本代码:
#!/bin/bash# 获取当前脚本所在目录
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)# 创建 XMind 文件
xmind_content=$(cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<xmap-content xmlns="urn:xmind:xmap:xmlns:content:2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"><sheet id="rootSheet" theme="EB4B5A81-BE0B-4BDB-9CA9-DFC508B6FB32" timestamp="1621794293087" modified-by="admin" pre-saved="true" style-id="sheet-default"><title>信息抽取参数分类清单</title><topic id="rootTopic" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>信息抽取参数分类清单</title><children><topics><topic id="subTopic1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>实体识别</title><children><topics><topic id="subTopic1-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>人名</title></topic><topic id="subTopic1-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>地名</title></topic><topic id="subTopic1-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>组织名</title></topic><topic id="subTopic1-4" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>日期和时间</title></topic><topic id="subTopic1-5" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>数量</title></topic><topic id="subTopic1-6" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>货币金额</title></topic></topics></children></topic><topic id="subTopic2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>关系抽取</title><children><topics><topic id="subTopic2-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>人物之间的关系</title></topic><topic id="subTopic2-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>地点之间的关系</title></topic><topic id="subTopic2-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>组织之间的关系</title></topic><topic id="subTopic2-4" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件之间的关系</title></topic></topics></children></topic><topic id="subTopic3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件抽取</title><children><topics><topic id="subTopic3-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件类型</title></topic><topic id="subTopic3-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件参与者</title></topic><topic id="subTopic3-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件时间</title></topic><topic id="subTopic3-4" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件地点</title></topic><topic id="subTopic3-5" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件结果</title></topic></topics></children></topic><topic id="subTopic4" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>属性抽取</title><children><topics><topic id="subTopic4-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>实体的描述性特征</title></topic><topic id="subTopic4-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>事件的描述性特征</title></topic></topics></children></topic><topic id="subTopic5" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>情感分析</title><children><topics><topic id="subTopic5-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>文本的情感倾向</title></topic><topic id="subTopic5-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>情感强度</title></topic><topic id="subTopic5-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>情感目标</title></topic></topics></children></topic><topic id="subTopic6" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>观点抽取</title><children><topics><topic id="subTopic6-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>观点持有者</title></topic><topic id="subTopic6-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>观点内容</title></topic><topic id="subTopic6-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>观点对象</title></topic><topic id="subTopic6-4" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>观点强度</title></topic></topics></children></topic><topic id="subTopic7" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>文本分类</title><children><topics><topic id="subTopic7-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>主题分类</title></topic><topic id="subTopic7-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>标签分类</title></topic><topic id="subTopic7-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>情感分类</title></topic></topics></children></topic><topic id="subTopic8" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>文本聚类</title><children><topics><topic id="subTopic8-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>主题聚类</title></topic><topic id="subTopic8-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>语义聚类</title></topic><topic id="subTopic8-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>功能聚类</title></topic></topics></children></topic><topic id="subTopic9" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>关键词抽取</title><children><topics><topic id="subTopic9-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>文本的主要关键词</title></topic><topic id="subTopic9-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>关键词的权重或重要性</title></topic></topics></children></topic><topic id="subTopic10" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>摘要生成</title><children><topics><topic id="subTopic10-1" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>主要信息摘要</title></topic><topic id="subTopic10-2" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>关键点摘要</title></topic><topic id="subTopic10-3" timestamp="1621794293087" modified-by="admin" branch="1" style-id="topic-default"><title>摘要的长度和格式</title></topic></topics></children></topic></topics></children></topic></sheet>
</xmap-content>
)# 将 XMind 文件转换为图片
xmind_path="$script_dir/information_extraction_parameters.xmind"
output_path="$script_dir/information_extraction_parameters.png"
/Applications/XMind.app/Contents/MacOS/XMind -n -p "$xmind_path" -o "$output_path"echo "已生成信息抽取参数分类清单图片:$output_path"
这个脚本会首先获取当前脚本所在的目录(即变量script_dir
),然后使用该目录来构建XMind文件和输出图片的完整路径。这样就不需要手动指定路径了,而是可以通过相对路径来创建文件和输出结果。