rules

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

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

func ProcessTransRe

func ProcessTransRe(SymbolSet symbolset.SymbolSet, Regexp string) (*regexp2.Regexp, error)

ProcessTransRe converts pre-defined entities to the appropriate symbols. Strings replaced are: syllabic, nonsyllabic, phoneme, symbol.

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) Name

func (r Decomp2Orth) Name() string

Name is the name of this rule

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) Name

func (r IllegalTransRe) Name() string

Name is the name of this rule

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) Name

func (r MustHaveTrans) Name() string

Name is the name of this rule

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) Name

func (r NoEmptyTrans) Name() string

Name is the name of this rule

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) Name

func (r RequiredTransRe) Name() string

Name is the name of this rule

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

type SymbolSetRule struct {
	SymbolSet symbolset.SymbolSet
}

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) Name

func (r SymbolSetRule) Name() string

Name is the name of this rule

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

Jump to

Keyboard shortcuts

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