元编程参考文档

文本任务

10 个节点

本页内容 10

回答问题

函数

Answers a question with the passage of a text that answers it.

签名
回答问题 -> (答案: 文本, 分数: 数字)
    问答模型: Question Answerer
    问题: 文本
    上下文: 文本
string AnswerQuestion(
    QuestionAnswerer answerer,
    string question,
    string context,
    out double score)

参数

名称类型默认值说明
问答模型Question Answerer—A question-answering model.
问题文本—The question.
上下文文本—The text the answer is taken from; a long text is read in overlapping windows.

返回

答案文本
分数数字
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

文本分类

函数

The labels that best describe a text, best first.

签名
文本分类 -> (标签: 文本数组, 分数: 数字数组)
    分类器: Text Classifier
    文本: 文本
    前几名: 整数
string[] ClassifyText(
    TextClassifier classifier,
    string text,
    int top,
    out double[] scores)

参数

名称类型默认值说明
分类器Text Classifier—A text classifier.
文本文本—The text.
前几名整数—How many labels to give; 0 for all of them.

返回

标签文本数组
分数数字数组
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

零样本文本分类

函数

Scores a text against labels written in words, best first.

签名
零样本文本分类 -> (标签: 文本数组, 分数: 数字数组)
    分类器: Zero Shot Text Classifier
    文本: 文本
    标签: 文本数组
    模板: 文本
    多标签: 真否
string[] ClassifyTextZeroShot(
    ZeroShotTextClassifier classifier,
    string text,
    string[] labels,
    string template,
    bool multiLabel,
    out double[] scores)

参数

名称类型默认值说明
分类器Zero Shot Text Classifier—A zero-shot text classifier.
文本文本—The text.
标签文本数组—The candidate labels, such as "technology", "sports", "cooking".
模板文本—The sentence each label is put into; {} stands for the label.
多标签真否—Score each label on its own, so several can apply, rather than sharing one probability among them.

返回

标签文本数组
分数数字数组
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

填充掩码

函数

The likeliest words for the mask token in a text, best first, with the text each makes.

签名
填充掩码 -> (候选词: 文本数组, 文本: 文本数组, 分数: 数字数组)
    填充模型: Mask Filler
    文本: 文本
    前几名: 整数
string[] FillMask(
    MaskFiller filler,
    string text,
    int top,
    out string[] texts,
    out double[] scores)

参数

名称类型默认值说明
填充模型Mask Filler—A masked language model.
文本文本—A text with the model's mask token in it once, such as "Paris is the [MASK] of France."
前几名整数—How many guesses to give.

返回

候选词文本数组
文本文本数组
分数数字数组
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

加载实体识别器

函数

Loads a named-entity recognizer from a Hub repository or a folder.

签名
加载实体识别器 -> Entity Recognizer
    模型: 文本
    设备: Compute Device
    精度: Precision
    后端: Model Backend
EntityRecognizer LoadEntityRecognizer(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

参数

名称类型默认值说明
模型文本—A repository id such as dslim/bert-base-NER, or a folder.
设备Compute Device自动Where it runs, on TorchSharp.
精度Precision自动The number format of its weights, on TorchSharp.
后端Model BackendTorchSharpTorchSharp, or the managed ONNX backend on the CPU.

返回

识别器Entity Recognizer
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

加载掩码填充模型

函数

Loads a masked language model from a Hub repository or a folder.

签名
加载掩码填充模型 -> Mask Filler
    模型: 文本
    设备: Compute Device
    精度: Precision
    后端: Model Backend
MaskFiller LoadMaskFiller(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

参数

名称类型默认值说明
模型文本—A repository id such as distilbert/distilbert-base-uncased or FacebookAI/roberta-base, or a folder.
设备Compute Device自动Where it runs, on TorchSharp.
精度Precision自动The number format of its weights, on TorchSharp.
后端Model BackendTorchSharpTorchSharp, or the managed ONNX backend on the CPU.

返回

填充模型Mask Filler
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

加载问答模型

函数

Loads an extractive question-answering model from a Hub repository or a folder.

签名
加载问答模型 -> Question Answerer
    模型: 文本
    设备: Compute Device
    精度: Precision
    后端: Model Backend
QuestionAnswerer LoadQuestionAnswerer(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

参数

名称类型默认值说明
模型文本—A repository id such as deepset/roberta-base-squad2, or a folder.
设备Compute Device自动Where it runs, on TorchSharp.
精度Precision自动The number format of its weights, on TorchSharp.
后端Model BackendTorchSharpTorchSharp, or the managed ONNX backend on the CPU.

返回

问答模型Question Answerer
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

加载文本分类器

函数

Loads a text classifier from a Hub repository or a folder.

签名
加载文本分类器 -> Text Classifier
    模型: 文本
    设备: Compute Device
    精度: Precision
    后端: Model Backend
TextClassifier LoadTextClassifier(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

参数

名称类型默认值说明
模型文本—A repository id such as distilbert/distilbert-base-uncased-finetuned-sst-2-english, or a folder.
设备Compute Device自动Where it runs, on TorchSharp.
精度Precision自动The number format of its weights, on TorchSharp.
后端Model BackendTorchSharpTorchSharp, or the managed ONNX backend on the CPU.

返回

分类器Text Classifier
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

加载零样本文本分类器

函数

Loads a zero-shot text classifier (a model trained on natural-language inference) from a Hub repository or a folder.

签名
加载零样本文本分类器 -> Zero Shot Text Classifier
    模型: 文本
    设备: Compute Device
    精度: Precision
    后端: Model Backend
ZeroShotTextClassifier LoadZeroShotTextClassifier(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

参数

名称类型默认值说明
模型文本—A repository id such as MoritzLaurer/xtremedistil-l6-h256-zeroshot-v1.1-all-33, or a folder.
设备Compute Device自动Where it runs, on TorchSharp.
精度Precision自动The number format of its weights, on TorchSharp.
后端Model BackendTorchSharpTorchSharp, or the managed ONNX backend on the CPU.

返回

分类器Zero Shot Text Classifier
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习

识别实体

函数

The names a text mentions and what each is - PER, LOC, ORG, MISC for most English models - in the order they appear.

签名
识别实体 -> (实体: 文本数组, 类型: 文本数组, 分数: 数字数组, 起始: 整数数组)
    识别器: Entity Recognizer
    文本: 文本
string[] RecognizeEntities(
    EntityRecognizer recognizer,
    string text,
    out string[] types,
    out double[] scores,
    out int[] starts)

参数

名称类型默认值说明
识别器Entity Recognizer—An entity recognizer.
文本文本—The text.

返回

实体文本数组
类型文本数组
分数数字数组
起始整数数组
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
文本任务
所属包
机器学习