Documentation ¶
Overview ¶
Package rules contains a few general validation rule types. The validation design and interfaces can be found in package validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decomp2Orth ¶
type Decomp2Orth struct { CompDelim string AcceptEmptyDecomp bool PreFilterWordPartString func(string) (string, error) Accept []lex.Entry Reject []lex.Entry }
Decomp2Orth is a general rule type to validate the word parts vs. the orthography. A filter is used to control the filtering, typically how to treat triple consonants at boundaries.
func (Decomp2Orth) Level ¶
func (r Decomp2Orth) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (Decomp2Orth) ShouldAccept ¶
func (r Decomp2Orth) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (Decomp2Orth) ShouldReject ¶
func (r Decomp2Orth) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (Decomp2Orth) Validate ¶
func (r Decomp2Orth) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type IllegalTransRe ¶
type IllegalTransRe struct { NameStr string LevelStr string Message string Re *regexp2.Regexp Accept []lex.Entry Reject []lex.Entry }
IllegalTransRe is a general rule type to check for illegal transcriptions by regexp
func (IllegalTransRe) Level ¶
func (r IllegalTransRe) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (IllegalTransRe) ShouldAccept ¶
func (r IllegalTransRe) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (IllegalTransRe) ShouldReject ¶
func (r IllegalTransRe) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (IllegalTransRe) Validate ¶
func (r IllegalTransRe) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type MustHaveTrans ¶
type MustHaveTrans struct { }
MustHaveTrans is a general rule to make sure each entry has at least one transcription
func (MustHaveTrans) Level ¶
func (r MustHaveTrans) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (MustHaveTrans) ShouldAccept ¶
func (r MustHaveTrans) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (MustHaveTrans) ShouldReject ¶
func (r MustHaveTrans) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (MustHaveTrans) Validate ¶
func (r MustHaveTrans) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type NoEmptyTrans ¶
type NoEmptyTrans struct { }
NoEmptyTrans is a general rule to make sure no transcriptions are be empty
func (NoEmptyTrans) Level ¶
func (r NoEmptyTrans) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (NoEmptyTrans) ShouldAccept ¶
func (r NoEmptyTrans) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (NoEmptyTrans) ShouldReject ¶
func (r NoEmptyTrans) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (NoEmptyTrans) Validate ¶
func (r NoEmptyTrans) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type RequiredTransRe ¶
type RequiredTransRe struct { NameStr string LevelStr string Message string Re *regexp2.Regexp Accept []lex.Entry Reject []lex.Entry }
RequiredTransRe is a general rule type used to defined basic transcription requirements using regexps
func (RequiredTransRe) Level ¶
func (r RequiredTransRe) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (RequiredTransRe) ShouldAccept ¶
func (r RequiredTransRe) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (RequiredTransRe) ShouldReject ¶
func (r RequiredTransRe) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (RequiredTransRe) Validate ¶
func (r RequiredTransRe) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type SymbolSetRule ¶
SymbolSetRule is a general rule for verifying that each phoneme is a legal symbol
func (SymbolSetRule) Level ¶
func (r SymbolSetRule) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (SymbolSetRule) ShouldAccept ¶
func (r SymbolSetRule) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (SymbolSetRule) ShouldReject ¶
func (r SymbolSetRule) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (SymbolSetRule) Validate ¶
func (r SymbolSetRule) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry