元編程參考文件

文字任務

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.

返回

實體文字陣列
型別文字陣列
分數數字陣列
起始整數陣列
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
文字任務
所屬包
機器學習