rule

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[string]Rule

Map maps concept URLs to compiled rules.

func NewMap

func NewMap(rs map[string]string, lookup func(string) int) (Map, error)

NewMap compiles a new Map from a map of rules.

type Rule

type Rule []instruction

Rule represents a compiled rule.

func Compile

func Compile(expr string, lookup func(string) int) (r Rule, err error)

Compile compiles a rule from an expression. The lookup function is used to map strings to concept ids. If lookup returns a number <= 0, the concept could not be found and an error will be returned from Compile.

func (Rule) Execute

func (r Rule) Execute(memory *memory.Memory) float64

Execute executes a rule and returns its result.

func (Rule) String

func (r Rule) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL