Documentation ¶
Index ¶
- type Limit
- type Relation
- func (r *Relation) HumanReadable() string
- func (r *Relation) JSON() string
- func (r *Relation) Less(q *Relation) bool
- func (r *Relation) Negate(valueRange []string)
- func (r *Relation) Normalize(valueRange []string)
- func (r *Relation) SetScore(score float64)
- func (r *Relation) SetUnitField(v *variables.Variable)
- func (r *Relation) SetVariableFields(v *variables.Variable)
- func (r *Relation) Split() Relations
- func (r *Relation) Transform()
- func (r *Relation) Valid() bool
- type Relations
- func (rs *Relations) Dedupe()
- func (rs Relations) Empty() bool
- func (rs Relations) JSON() string
- func (rs Relations) MinScore() float64
- func (rs Relations) Negate()
- func (rs *Relations) Process()
- func (rs Relations) SetScore(score float64)
- func (rs Relations) Sort()
- func (rs Relations) Transform()
- func (rs Relations) VariableIDs() []variables.ID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limit ¶
type Limit struct { Incl bool `json:"incl"` // True if limit is inclusive Value string `json:"value"` // Value of limit bound }
Limit defines a lower or upper bound of a numerical relation.
type Relation ¶
type Relation struct { ID variables.ID `json:"id,omitempty"` Name string `json:"name"` // Relation name, typically the variable name DisplayName string `json:"-"` // Variable display name Unit string `json:"unit,omitempty"` // Variable unit Value []string `json:"value,omitempty"` // Valid values of categorical relation Lower *Limit `json:"lower,omitempty"` // Lower bound of numerical relation condition Upper *Limit `json:"upper,omitempty"` // Upper bound of numerical relation condition VariableType variables.Type `json:"variableType"` // Type of relation Score float64 `json:"score"` // Confidence estimate of the relation representation being correct }
Relation defines a boolean, nominal, ordinal, or numerical criterion.
func NewCategorical ¶
NewCategorical creates a new relation of type boolean, nominal, or ordinal.
func (*Relation) HumanReadable ¶
HumanReadable converts the relation to the human readable form.
func (*Relation) Normalize ¶
Normalize normalizes the relation by making the relation content consistent with the variable type.
func (*Relation) SetScore ¶
SetScore sets the confidence score that the relation is parsed correctly.
func (*Relation) SetUnitField ¶
SetUnitField sets the variable unit to the default value if the unit missing.
func (*Relation) SetVariableFields ¶
SetVariableFields sets the variable display name and type per variable id.
func (*Relation) Split ¶
Split splits the combination relation into individual relations. Because such relations may not have a valid ID, the split operation needs to be done before validation.
func (*Relation) Transform ¶
func (r *Relation) Transform()
Transform transforms criteria relations by converting parsed values to strings of valid literals. If a valid literal cannot be inferred, the confidence score of the relation is set to zero. Indifferent nominal relations are removed by setting the confidence score to zero.
type Relations ¶
type Relations []*Relation
Relations defines a slice of relations.
func (*Relations) Process ¶
func (rs *Relations) Process()
Process splits the relations if needed, sets the correct types, normalizes and removes invalid relations.
func (Relations) SetScore ¶
SetScore sets the confidence score that the relations are parsed correctly.
func (Relations) VariableIDs ¶
VariableIDs returns the variable ids contained in the relations.