Text Tasks
10 nodes
On this page 10
Answer Question
FunctionAnswers a question with the passage of a text that answers it.
AnswerQuestion -> (Answer: Text, score: Number)
answerer: Question Answerer
question: Text
context: Textstring AnswerQuestion(
QuestionAnswerer answerer,
string question,
string context,
out double score)Parameters
| name | type | default | description |
|---|---|---|---|
| answerer | Question Answerer | — | A question-answering model. |
| question | Text | — | The question. |
| context | Text | — | The text the answer is taken from; a long text is read in overlapping windows. |
Returns
| Answer | Text |
| score | Number |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Classify Text
FunctionThe labels that best describe a text, best first.
ClassifyText -> (Labels: Text Array, scores: Number Array)
classifier: Text Classifier
text: Text
top: Integerstring[] ClassifyText(
TextClassifier classifier,
string text,
int top,
out double[] scores)Parameters
| name | type | default | description |
|---|---|---|---|
| classifier | Text Classifier | — | A text classifier. |
| text | Text | — | The text. |
| top | Integer | — | How many labels to give; 0 for all of them. |
Returns
| Labels | Text Array |
| scores | Number Array |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Classify Text Zero-Shot
FunctionScores a text against labels written in words, best first.
ClassifyTextZeroShot -> (Labels: Text Array, scores: Number Array)
classifier: Zero Shot Text Classifier
text: Text
labels: Text Array
template: Text
multiLabel: Truthstring[] ClassifyTextZeroShot(
ZeroShotTextClassifier classifier,
string text,
string[] labels,
string template,
bool multiLabel,
out double[] scores)Parameters
| name | type | default | description |
|---|---|---|---|
| classifier | Zero Shot Text Classifier | — | A zero-shot text classifier. |
| text | Text | — | The text. |
| labels | Text Array | — | The candidate labels, such as "technology", "sports", "cooking". |
| template | Text | — | The sentence each label is put into; {} stands for the label. |
| multiLabel | Truth | — | Score each label on its own, so several can apply, rather than sharing one probability among them. |
Returns
| Labels | Text Array |
| scores | Number Array |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Fill Mask
FunctionThe likeliest words for the mask token in a text, best first, with the text each makes.
FillMask -> (Words: Text Array, texts: Text Array, scores: Number Array)
filler: Mask Filler
text: Text
top: Integerstring[] FillMask(
MaskFiller filler,
string text,
int top,
out string[] texts,
out double[] scores)Parameters
| name | type | default | description |
|---|---|---|---|
| filler | Mask Filler | — | A masked language model. |
| text | Text | — | A text with the model's mask token in it once, such as "Paris is the [MASK] of France." |
| top | Integer | — | How many guesses to give. |
Returns
| Words | Text Array |
| texts | Text Array |
| scores | Number Array |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Load Entity Recognizer
FunctionLoads a named-entity recognizer from a Hub repository or a folder.
LoadEntityRecognizer -> Entity Recognizer
model: Text
device: Compute Device
precision: Precision
backend: Model BackendEntityRecognizer LoadEntityRecognizer(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
ModelBackend backend = ModelBackend.TorchSharp)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as dslim/bert-base-NER, or a folder. |
| device | Compute Device | Auto | Where it runs, on TorchSharp. |
| precision | Precision | Auto | The number format of its weights, on TorchSharp. |
| backend | Model Backend | Torch sharp | TorchSharp, or the managed ONNX backend on the CPU. |
Returns
| Recognizer | Entity Recognizer |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Load Mask Filler
FunctionLoads a masked language model from a Hub repository or a folder.
LoadMaskFiller -> Mask Filler
model: Text
device: Compute Device
precision: Precision
backend: Model BackendMaskFiller LoadMaskFiller(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
ModelBackend backend = ModelBackend.TorchSharp)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as distilbert/distilbert-base-uncased or FacebookAI/roberta-base, or a folder. |
| device | Compute Device | Auto | Where it runs, on TorchSharp. |
| precision | Precision | Auto | The number format of its weights, on TorchSharp. |
| backend | Model Backend | Torch sharp | TorchSharp, or the managed ONNX backend on the CPU. |
Returns
| Filler | Mask Filler |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Load Question Answerer
FunctionLoads an extractive question-answering model from a Hub repository or a folder.
LoadQuestionAnswerer -> Question Answerer
model: Text
device: Compute Device
precision: Precision
backend: Model BackendQuestionAnswerer LoadQuestionAnswerer(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
ModelBackend backend = ModelBackend.TorchSharp)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as deepset/roberta-base-squad2, or a folder. |
| device | Compute Device | Auto | Where it runs, on TorchSharp. |
| precision | Precision | Auto | The number format of its weights, on TorchSharp. |
| backend | Model Backend | Torch sharp | TorchSharp, or the managed ONNX backend on the CPU. |
Returns
| Answerer | Question Answerer |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Load Text Classifier
FunctionLoads a text classifier from a Hub repository or a folder.
LoadTextClassifier -> Text Classifier
model: Text
device: Compute Device
precision: Precision
backend: Model BackendTextClassifier LoadTextClassifier(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
ModelBackend backend = ModelBackend.TorchSharp)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as distilbert/distilbert-base-uncased-finetuned-sst-2-english, or a folder. |
| device | Compute Device | Auto | Where it runs, on TorchSharp. |
| precision | Precision | Auto | The number format of its weights, on TorchSharp. |
| backend | Model Backend | Torch sharp | TorchSharp, or the managed ONNX backend on the CPU. |
Returns
| Classifier | Text Classifier |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Load Zero-Shot Text Classifier
FunctionLoads a zero-shot text classifier (a model trained on natural-language inference) from a Hub repository or a folder.
LoadZeroShotTextClassifier -> Zero Shot Text Classifier
model: Text
device: Compute Device
precision: Precision
backend: Model BackendZeroShotTextClassifier LoadZeroShotTextClassifier(
string model,
ComputeDevice device = ComputeDevice.Auto,
Precision precision = Precision.Auto,
ModelBackend backend = ModelBackend.TorchSharp)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Text | — | A repository id such as MoritzLaurer/xtremedistil-l6-h256-zeroshot-v1.1-all-33, or a folder. |
| device | Compute Device | Auto | Where it runs, on TorchSharp. |
| precision | Precision | Auto | The number format of its weights, on TorchSharp. |
| backend | Model Backend | Torch sharp | TorchSharp, or the managed ONNX backend on the CPU. |
Returns
| Classifier | Zero Shot Text Classifier |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning
Recognize Entities
FunctionThe names a text mentions and what each is - PER, LOC, ORG, MISC for most English models - in the order they appear.
RecognizeEntities -> (Entities: Text Array, types: Text Array, scores: Number Array, starts: Integer Array)
recognizer: Entity Recognizer
text: Textstring[] RecognizeEntities(
EntityRecognizer recognizer,
string text,
out string[] types,
out double[] scores,
out int[] starts)Parameters
| name | type | default | description |
|---|---|---|---|
| recognizer | Entity Recognizer | — | An entity recognizer. |
| text | Text | — | The text. |
Returns
| Entities | Text Array |
| types | Text Array |
| scores | Number Array |
| starts | Integer Array |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Text Tasks
- Package
- Machine Learning