Documentation
¶
Overview ¶
Package rules contains a few general validation rule types. The validation design and interfaces can be found in package validation.
Index ¶
- func NewIllegalOrthRe(ss symbolset.SymbolSet, name string, level string, re string, msg string, ...) (validation.Rule, error)
- func NewIllegalTagRe(ss symbolset.SymbolSet, name string, level string, re string, msg string, ...) (validation.Rule, error)
- func NewIllegalTransRe(ss symbolset.SymbolSet, name string, level string, re string, msg string, ...) (validation.Rule, error)
- func NewRequiredOrthRe(ss symbolset.SymbolSet, name string, level string, re string, msg string, ...) (validation.Rule, error)
- func NewRequiredTagRe(ss symbolset.SymbolSet, name string, level string, re string, msg string, ...) (validation.Rule, error)
- func NewRequiredTransRe(ss symbolset.SymbolSet, name string, level string, re string, msg string, ...) (validation.Rule, error)
- func ProcessRe(Regexp string) (*regexp2.Regexp, error)
- func ProcessTransRe(SymbolSet symbolset.SymbolSet, Regexp string) (*regexp2.Regexp, error)
- type Decomp2Orth
- type EmptyRule
- type IllegalOrthRe
- type IllegalTagRe
- type IllegalTransRe
- type MustHaveTrans
- type NoEmptyTrans
- type RequiredOrthRe
- type RequiredTagRe
- type RequiredTransRe
- type SymbolSetRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIllegalOrthRe ¶ added in v0.4.1
func NewIllegalTagRe ¶ added in v0.4.1
func NewIllegalTransRe ¶ added in v0.4.1
func NewRequiredOrthRe ¶ added in v0.4.1
func NewRequiredTagRe ¶ added in v0.4.1
func NewRequiredTransRe ¶ added in v0.4.1
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 EmptyRule ¶ added in v0.4.1
func (EmptyRule) Level ¶ added in v0.4.1
Level is the rule level (typically format, fatal, warning, info)
func (EmptyRule) ShouldAccept ¶ added in v0.4.1
ShouldAccept returns a slice of entries that the rule should accept
func (EmptyRule) ShouldReject ¶ added in v0.4.1
ShouldReject returns a slice of entries that the rule should reject
type IllegalOrthRe ¶ added in v0.4.1
type IllegalOrthRe struct {
NameStr string
LevelStr string
Message string
Re *regexp2.Regexp
Accept []lex.Entry
Reject []lex.Entry
}
IllegalOrthRe is a general rule type to check for illegal orthographies by regexp
func (IllegalOrthRe) Level ¶ added in v0.4.1
func (r IllegalOrthRe) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (IllegalOrthRe) Name ¶ added in v0.4.1
func (r IllegalOrthRe) Name() string
Name is the name of this rule
func (IllegalOrthRe) ShouldAccept ¶ added in v0.4.1
func (r IllegalOrthRe) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (IllegalOrthRe) ShouldReject ¶ added in v0.4.1
func (r IllegalOrthRe) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (IllegalOrthRe) Validate ¶ added in v0.4.1
func (r IllegalOrthRe) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type IllegalTagRe ¶ added in v0.4.1
type IllegalTagRe struct {
NameStr string
LevelStr string
Message string
Re *regexp2.Regexp
Accept []lex.Entry
Reject []lex.Entry
}
IllegalTagRe is a general rule type to check for illegal tag by regexp
func (IllegalTagRe) Level ¶ added in v0.4.1
func (r IllegalTagRe) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (IllegalTagRe) Name ¶ added in v0.4.1
func (r IllegalTagRe) Name() string
Name is the name of this rule
func (IllegalTagRe) ShouldAccept ¶ added in v0.4.1
func (r IllegalTagRe) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (IllegalTagRe) ShouldReject ¶ added in v0.4.1
func (r IllegalTagRe) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (IllegalTagRe) Validate ¶ added in v0.4.1
func (r IllegalTagRe) 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 ¶
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 ¶
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 RequiredOrthRe ¶ added in v0.4.1
type RequiredOrthRe struct {
NameStr string
LevelStr string
Message string
Re *regexp2.Regexp
Accept []lex.Entry
Reject []lex.Entry
}
RequiredOrthRe is a general rule type used to defined basic orthography requirements using regexps
func (RequiredOrthRe) Level ¶ added in v0.4.1
func (r RequiredOrthRe) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (RequiredOrthRe) Name ¶ added in v0.4.1
func (r RequiredOrthRe) Name() string
Name is the name of this rule
func (RequiredOrthRe) ShouldAccept ¶ added in v0.4.1
func (r RequiredOrthRe) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (RequiredOrthRe) ShouldReject ¶ added in v0.4.1
func (r RequiredOrthRe) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (RequiredOrthRe) Validate ¶ added in v0.4.1
func (r RequiredOrthRe) Validate(e lex.Entry) (validation.Result, error)
Validate a lex.Entry
type RequiredTagRe ¶ added in v0.4.1
type RequiredTagRe struct {
NameStr string
LevelStr string
Message string
Re *regexp2.Regexp
Accept []lex.Entry
Reject []lex.Entry
}
RequiredTagRe is a general rule type used to defined basic tag requirements using regexps
func (RequiredTagRe) Level ¶ added in v0.4.1
func (r RequiredTagRe) Level() string
Level is the rule level (typically format, fatal, warning, info)
func (RequiredTagRe) Name ¶ added in v0.4.1
func (r RequiredTagRe) Name() string
Name is the name of this rule
func (RequiredTagRe) ShouldAccept ¶ added in v0.4.1
func (r RequiredTagRe) ShouldAccept() []lex.Entry
ShouldAccept returns a slice of entries that the rule should accept
func (RequiredTagRe) ShouldReject ¶ added in v0.4.1
func (r RequiredTagRe) ShouldReject() []lex.Entry
ShouldReject returns a slice of entries that the rule should reject
func (RequiredTagRe) Validate ¶ added in v0.4.1
func (r RequiredTagRe) 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