CreateSemanticSearchIndex[source]
从 source 中的数据创建搜索索引.
CreateSemanticSearchIndex[{source1,…}]
用一系列资源创建搜索索引 sourcei.
CreateSemanticSearchIndex[{source1val1,…}]
将资源 sourcei 与值 vali 关联在一起.
CreateSemanticSearchIndex[data,"name"]
为搜索索引指定名称.
CreateSemanticSearchIndex
CreateSemanticSearchIndex[source]
从 source 中的数据创建搜索索引.
CreateSemanticSearchIndex[{source1,…}]
用一系列资源创建搜索索引 sourcei.
CreateSemanticSearchIndex[{source1val1,…}]
将资源 sourcei 与值 vali 关联在一起.
CreateSemanticSearchIndex[data,"name"]
为搜索索引指定名称.
更多信息和选项
- CreateSemanticSearchIndex 用于从文本中提取可用来对内容进行语义搜索的特征.
- source 可取的值有:
-
"string" 纯字符串 File["path"] 单个文件 URL["url"] "url" 的文本表示 CloudObject[…] 云对象 LocalObject[…] 本地对象 ContentObject[…] 内容对象 {source1,source2,…} 资源列表 - 可为资源添加注释. 来自给定资源的每个数据块都将具有相同的注释.
- 指定注释的可能的方法包括:
-
{soure1val1,…} 资源和关联的值组成的列表 {source1,…}{val1,…} 资源和值组成的规则 - 可接受的 vali 的形式包括:
-
"string" 字符串标签 <|"tag1"v1,…|> 标签和元数据值组成的关联 - CreateSemanticSearchIndex 支持以下选项:
-
DistanceFunction EuclideanDistance 使用的距离函数 FeatureExtractor "MiniLM" 如何从文本片段中提取特征 GeneratedAssetLocation $GeneratedAssetLocation 索引的位置 Method Automatic 方法的详细信息 OverwriteTarget Automatic 是否覆盖现有位置 ProgressReporting $ProgressReporting 是否报告计算进度 WorkingPrecision "Real32" 浮点计算的精度 - DistanceFunction 可取的值包括 EuclideanDistance、SquaredEuclideanDistance、CosineDistance、JaccardDissimilarity 和 HammingDistance.
- FeatureExtractor 可取的值包括:
-
"SentenceBERT" 基于 SentenceBERT 的本地模型 LLMConfiguration 基于 LLM 的语句嵌入 f 自定义的提取函数 - 自定义的提取函数 f 必须在字符串列表上进行操作并生成相同长度的向量列表.
- 通过 Method<|opt1val1|> 给出选项. opti 可取的值有:
-
"ContextPadding" 
片段之间的最小重叠 "MaximumItemLength" 
文本片段的最小长度 "MinimumItemLength" 
文本片段的最大长度 "SplitPattern" Automatic 在哪里分割长字符串 - 设为自动的 "SplitPattern" 尝试将资源文本拆分为段落、换行符和单词,创建长度位于 "MinimumItemLength" 和 "MaximumItemLength" 之间的片段.
- WorkingPrecision 可能的设置包括:
-
"Integer8" 从 -128 到 127 的有符号 8 位整数 "Real32" 单精度实数 (32-bit) "Real64" 双精度实数 (64-bit)
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (6)
注释 (2)
选项 (10)
DistanceFunction (1)
默认情况下,使用 EuclideanDistance:
GeneratedAssetLocation (3)
Method (2)
OverwriteTarget (2)
如果采用默认的 OverwriteTargetAutomatic,将生成一个新的索引名称以避免冲突:
如果想强制覆盖,可使用 OverwriteTargetTrue:
用 OverwriteTargetFalse 进行更严格的检查:
OverwriteTargetFalse 还将防止在不同位置重复使用相同的索引名称:
用 OverwriteTargetTrue 覆盖现有文件:
属性和关系 (1)
FeatureExtract 可使用指定的 "SentenceVector" 提取器来创建类似的嵌入:
相关指南
文本
Wolfram Research (2024),CreateSemanticSearchIndex,Wolfram 语言函数,https://reference.wolfram.com/language/ref/CreateSemanticSearchIndex.html (更新于 2025 年).
CMS
Wolfram 语言. 2024. "CreateSemanticSearchIndex." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2025. https://reference.wolfram.com/language/ref/CreateSemanticSearchIndex.html.
APA
Wolfram 语言. (2024). CreateSemanticSearchIndex. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/CreateSemanticSearchIndex.html 年
BibTeX
@misc{reference.wolfram_2025_createsemanticsearchindex, author="Wolfram Research", title="{CreateSemanticSearchIndex}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/CreateSemanticSearchIndex.html}", note=[Accessed: 12-April-2026]}
BibLaTeX
@online{reference.wolfram_2025_createsemanticsearchindex, organization={Wolfram Research}, title={CreateSemanticSearchIndex}, year={2025}, url={https://reference.wolfram.com/language/ref/CreateSemanticSearchIndex.html}, note=[Accessed: 12-April-2026]}