tok_eval: Evaluate a decision

View source: R/tok.R

tok_evalR Documentation

Evaluate a decision

Description

Evaluates a decision of the model for the given inputs, as ⁠tok eval⁠ does. In a model of language 0.7 the decision is evaluated with the decisions, input data and business knowledge models it requires, and the inputs are the input data by FEEL name; in earlier models the decision table alone is evaluated with the hit policy of the table.

Usage

tok_eval(x, decision, inputs = list(), lang = getOption("tok.lang", "en"))

Arguments

x

A model: a tok_model, the path of a .tok file, or the text of a model.

decision

Identifier of the decision.

inputs

Named list of inputs: numbers, strings, logical values, NA for null; a vector longer than one is a list, a named list is a context.

lang

Language of the messages, "en" or "pl". The default comes from the option tok.lang.

Value

In a model of language 0.7 the value of the decision (a number, string, logical value, list or named list; NULL for null), a list of named lists as a data frame. In earlier models: for the hit policies unique, first, any and priority a named list output name → value (NULL when no rule matches); for collect a data frame with one row per matched rule.

Examples

f <- system.file("examples", "propozycja-zakupu.tok", package = "tokr")
tok_eval(f, "tryb-akceptacji", list(rodzaj = "drukowana", cena = 120))

tokr documentation built on Nov. 26, 2026, 5:08 p.m.