Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicSanitizer ¶
The basic sanitizer: * lower-case * put spaces around numbers * put slaces around punctuation * collapse multiple spaces
Types ¶
type Rule ¶
type Rule struct { // The purpose of a Rule is to attach it's Tag to matching text. Tag string // Includes is a list of strings that must be found in the input in order to // match. Includes []string // Excludes is a list of strings that can exclude a match for this rule. Excludes []string // Blocks: If this rule is matched, then it will block matches of any tags // listed here. Blocks []string // The Score encodes the complexity of the Rule. A higher score indicates a // more specific match. A Rule more includes, or includes with multiple words // should havee a higher Score than a Rule with fewer includes or less // complex includes. Score int // contains filtered or unexported fields }
type RuleGroup ¶
A RuleGroup can be converted into a list of rules. Each rule will point to the same tag, and have the same exclude set and blocks.
func NewRuleGroup ¶
type RuleSet ¶
type RuleSet struct {
// contains filtered or unexported fields
}
func NewRuleSet ¶
func NewRuleSet() *RuleSet
func NewRuleSetFromList ¶
func (*RuleSet) AddRuleGroup ¶
func (*RuleSet) Match ¶
Return a list of matches with confidence. This is useful if you'd like to find the best matching rule out of all the matched rules.
If you just want to find all matching rules, then use MatchRules.
func (*RuleSet) MatchRules ¶
MatchRules will return a list of all matching rules. The rules are sorted by the match's Score. The best match will be first.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.