Documentation ¶
Index ¶
- Constants
- Variables
- func CHRerr(s *sc.Scanner, format string, a ...interface{})
- func CHRsolver(rs *RuleStore, max int)
- func CheckSpellAndText(spell Term, text Term) bool
- func ClearCHRStore(rs *RuleStore)
- func Email2text(spell Term) (Term, int, bool)
- func EqualVarName(t1, t2 Term) bool
- func EqualVarNameCList(t1 Term, t2 Term) bool
- func Eval(t1 Term) Term
- func InitSpellAndStructMap()
- func InitStore(rs *RuleStore)
- func NewArgCHR() *argCHR
- func ParseBIString(src string) (result Term, ok bool)
- func ParseGoalString(src string) (result Term, ok bool)
- func ParseHeadString(src string) (result Term, ok bool)
- func ParseRuleBodyString(src string) (result Term, ok bool)
- func Spell2name(spell Term) (Term, bool)
- func Spell2namenumber(spell Term) (Term, bool)
- func Spell2text(spell Term) (Term, bool)
- func Text2email(text Term) (Term, Term, bool)
- func Text2list(text Term) (Term, bool)
- func Text2spell(text Term) (Term, bool)
- func TraceRuleFired(rs *RuleStore, rule *chrRule) (ok bool)
- func WriteCHRStore(rs *RuleStore, out *os.File)
- func ZiffernZuZahl(spell Term) (Term, bool)
- type KeepCall
- type KeepReq
- type RuleStore
- func (rs *RuleStore) AddRule(name string, keep []string, del []string, guard []string, body []string) error
- func (rs *RuleStore) Infer(goals []string, max int) (bool, []string, error)
- func (rs *RuleStore) ParseFileCHRRulesGoals(inFile io.Reader) (ok bool)
- func (rs *RuleStore) ParseStringCHRRulesGoals(src string) (ok bool)
Constants ¶
View Source
const ( REmpty resultType = iota RStore RTrue RFalse )
View Source
const ( B2T = iota + 1 // "buchstabiertZuText" || "spell2text" B2N // "buchstabiertZuName" B2BZ // "buchstabiertZuBuchstabenZahlen" T2B // "textZuBuchstabiert" || "text2spell" // "abc-d" --> ["a","b","c","Bindestrich","d"] E2T // "emailZuText" 2-3 T2E // "textZuEmail" 2-3 Z2Z // "ziffernZuZahl" T2L // "textZuListe" || "text2list" // "abc-d" --> ["a","b","c","-","d"] JETZT // jetzt(Zeit) - now(Time) DATUM // datum(Zeit,Jahr, Monat, Tag, Wochentag) - date(Time, Year, Month, Day, Weekday) UHRZEIT // uhrzeit(Zeit, Stunde, Minute, Sekunde) - clock(Time, Hour, Min, Sec) NANOSEC // nanoSekunden(Zeit, Nanosekunden) - nanoSecond(Time, Integer) PLUSDATUM // plusDatum(Zeit, Jahr, Monat, Tag, NeueZeit) - addDate(Time, Year, Month, Day, NewTime) PLUSUHRZEIT // plusUhrzeit(Zeit, Stunde, Minute, Sekunde, NeueZeit) - addClock(Time, Hour, Min, Sec, NewTime) ZEIT // zeit(Jahr, Monat, Tag, Stunde, Minute, Sekunde, Zeit) - time(Year, Month, Day, Hour, Min, Sec, Time) )
View Source
const ( ParseHead parseType = iota ParseBI ParseGoal // CHR and Built-In ParseRuleBody // Chr, Built-In, true, false and Variable )
View Source
const EnvCache = 1
Variables ¶
View Source
var Char2SpellMap = map[rune]string{
'1': "Eins", '2': "Zwei", '3': "Drei", '4': "Vier", '5': "Fünf",
'6': "Sechs", '7': "Sieben", '8': "Acht", '9': "Neun", '0': "Null",
'ß': "Eszet",
'.': "Punkt", '/': "Schrägstrich", '@': "Ät", '%': "Prozent", '-': "Bindestrich",
'_': "Unterstrich", '#': "Raute", ':': "Doppelpunkt", ',': "Komma", ';': "Semikolon",
'|': "Senkrechter Strich", '\'': "Hochkomma",
'=': "Gleich", '&': "Und", '!': "Ausrufezeichen", '?': "Fragezeichen",
'+': "Plus", '*': "Sternchen", '´': "Akut-Akzent", '`': "Gravis-Akzent", '~': "Tilde",
'(': "Runde Klammer auf", ')': "Runde Klammer zu", '{': "Geschweifte Klammer auf", '}': "Geschweifte Klammer zu",
'[': "Eckige Klammer auf", ']': "Eckige Klammer zu", '<': "Spitze Klammer auf", '>': "Spitze Klammer zu",
'^': "Hochzeichen", '°': "Grad-Zeichen",
'"': "Anführungszeichen", '§': "Paragraph", '$': "Dollarzeichen",
'\\': "Umgekehrter Schrägstrich", '€': "Euro",
' ': "Leerzeichen"}
View Source
var CurVarCounter *big.Int
View Source
var Et = map[string]string{
"ät": "@",
"@": "@",
"et": "@",
"ed": "@",
"and": "@",
"der": "@",
"und": "@",
}
View Source
var EtHN1Word = map[string]string{
"etwa": "web",
"erklärt": "web",
"entweder": "mail",
}
@ Hotname
View Source
var EtHN2Words = map[string]map[string]string{
"etwa": {"günter": "magenta",
"agenta": "magenta",
"agenda": "magenta"},
}
View Source
var HN1WordMap = map[string]string{
"mailbox": "mailbox",
"inbox": "mailbox",
"posteo": "posteo",
"mail": "mail",
"gmx": "gmx",
"gmail": "gmail",
"emil": "gmail",
"hotmail": "hotmail",
"googlemail": "googlemail",
"web": "web",
"magenta": "magenta",
"aol": "aol",
"live": "live",
}
Maps 4 Hostname
View Source
var HN2WordsMap = map[string]map[string]string{
"t": {"online": "t-online"},
"die": {"online": "t-online"},
"de": {"online": "t-online"},
"mail": {"box": "mailbox"},
"post": {"t": "posteo", "theo": "posteo", "rio": "posteo"},
"kost": {"t": "posteo", "theo": "posteo", "rio": "posteo"},
"plus": {"t": "posteo"},
"google": {"mail": "googlemail"},
"dem": {"ex": "gmx"},
}
View Source
var HN3WordsMap = map[string]map[string]map[string]string{
"post": {"d": {"o": "posteo"},
"e": {"o": "posteo"}}}
View Source
var Punkt = map[string]string{
"punkt": "punkt",
"dot": "punkt",
"und": "punkt",
"um": "punkt",
"dort": "punkt",
"gott": "punkt",
"doch": "punkt",
"muss": "punkt",
"bot": "punkt",
}
View Source
var Punkt2Words = map[string]map[string]string{
"und": {"um": "punkt"},
}
View Source
var Spell2CharMap = map[string]rune{
"stern": '*', "at": '@', "klammeraffe": '@',
"affenschwanz": '@', "affenohr": '@', "affenschaukel": '@',
"minus": '-', "minuszeichen": '-', "strich": '-',
"apostroph": '\'',
"anführungsstrich": '"', "anführungsstriche": '"',
"anführungszeichen": '"', "gänsefüßchen": '"',
"backslash": '\\', "rückschrägstrich": '\\',
"einschaltungszeichen": '^', "einschaltzeichen": '^', "häkchen": '^', "dach": '^',
"grad": '°', "gleichheitszeichen": '=',
"strichpunkt": ';', "nummernzeichen": '#', "doppelkreuz": '#',
"hashtag": '#',
"leerzeichen": ' ', "space": ' ', "zwischenraum": ' ',
"leerstelle": ' ',
"ah": 'A', "be": 'B', "zeh": 'C', "de": 'D', "eh": 'E',
"ef": 'F', "geh": 'G', "ha": 'H', "ie": 'I', "jot": 'J',
"ka": 'K', "el": 'L', "em": 'M', "en": 'N', "oh": 'O', "pe": 'P', "kuh": 'Q', "qu": 'Q',
"er": 'R', "es": 'S', "tee": 'T', "uh": 'U', "Pfau": 'V', "weh": 'W',
"ixs": 'x', "ysilon": 'y', "zet": 'Z'}
Synonyme
View Source
var Spell2CharNameMap = map[string]rune{
"minus": '-', "minuszeichen": '-', "strich": '-', "bindestrich": '-',
"apostroph": '\'',
"leerzeichen": ' ', "space": ' ', "zwischenraum": ' ',
"leerstelle": ' ',
"ah": 'A', "be": 'B', "zeh": 'C', "de": 'D', "eh": 'E',
"ef": 'F', "geh": 'G', "ha": 'H', "ie": 'I', "jot": 'J',
"ka": 'K', "el": 'L', "em": 'M', "en": 'N', "oh": 'O', "pe": 'P', "kuh": 'Q', "qu": 'Q',
"er": 'R', "es": 'S', "tee": 'T', "uh": 'U', "Pfau": 'V', "weh": 'W',
"ixs": 'x', "ysilon": 'y', "zet": 'Z'}
View Source
var Spell2CharNameNumberMap = map[string]rune{
"ah": 'A', "be": 'B', "zeh": 'C', "de": 'D', "eh": 'E',
"ef": 'F', "geh": 'G', "ha": 'H', "ie": 'I', "jot": 'J',
"ka": 'K', "el": 'L', "em": 'M', "en": 'N', "oh": 'O', "pe": 'P', "kuh": 'Q', "qu": 'Q',
"er": 'R', "es": 'S', "tee": 't', "uh": 'U', "Pfau": 'V', "weh": 'W',
"ixs": 'x', "ysilon": 'y', "zet": 'Z'}
View Source
var Spell2WordsMap = map[string]map[string]rune{
"ist": {"gleich": '='},
"senkrechter": {"strich": '|'},
"vertikaler": {"strich": '|'},
"umgekehrter": {"schrägstrich": '\\'},
"rückwärts": {"schrägstrich": '\\'},
"accent": {"aigu": '´', "akut": '´', "grave": '`', "gravis": '`'},
"akzent": {"aigu": '´', "akut": '´', "grave": '`', "gravis": '`'},
"kleiner": {"als": '<'}, "größer": {"als": '>'},
"einfaches": {"ausführungszeichen": '\'', "anführungszeichen": '\''},
"scharfes": {"es": 'ß', "s": 'ß', "S": 'ß', "Es": 'ß'},
"es": {"zet": 'ß', "z": 'ß'},
"new": {"york": 'N'},
"doppeltes": {"anführungszeichen": '"'}}
View Source
var Spell2WordsNameMap = map[string]map[string]rune{
"accent": {"aigu": '´', "akut": '´', "grave": '`', "gravis": '`'},
"akzent": {"aigu": '´', "akut": '´', "grave": '`', "gravis": '`'},
"scharfes": {"es": 'ß', "s": 'ß', "S": 'ß', "Es": 'ß'},
"es": {"zet": 'ß', "z": 'ß'},
"new": {"york": 'N'}}
View Source
var Spell3WordsMap = map[string]map[string]map[string]rune{
"runde": {"klammer": {"auf": '(', "zu": ')'}},
"geschweifte": {"klammer": {"auf": '{', "zu": '}'}},
"geschwungene": {"klammer": {"auf": '{', "zu": '}'}},
"eckige": {"klammer": {"auf": '[', "zu": ']'}},
"spitze": {"klammer": {"auf": '<', "zu": '>'}},
}
View Source
var Struct1Word = map[string]string{
"bindestrich": "bindestrich",
"minus": "minus",
"unterstrich": "unterstrich",
"unterbricht": "unterstrich",
"strich": "strich",
"unterschrift": "unterstrich",
"mine": "minus",
}
View Source
var Struct2Words = map[string]map[string]string{
"bin": {"ich": "bindestrich"},
"und": {"das": "unterstrich",
"der": "unterstrich",
"ich": "unterstrich"},
}
View Source
var StructEle = map[string]bool{ "bindestrich": true, "minus": true, "unterstrich": true, "strich": true, "punkt": true, }
View Source
var TLD1WordMap = map[string]string{
"com": "com",
"kommen": "com",
"de": "de",
"d": "de",
"b": "de",
"geh": "de",
"e": "de",
"net": "net",
"org": "org",
"or": "org",
"ort": "org",
"auch": "org",
"bork": "org",
"eu": "eu",
"tr": "tr",
"ad": "ad",
"al": "al",
"at": "at",
"ax": "ax",
"ba": "ba",
"be": "be",
"bg": "bg",
"by": "by",
"ch": "ch",
"cy": "cy",
"cz": "cz",
"dk": "dk",
"ee": "ee",
"es": "es",
"fi": "fi",
"fo": "fo",
"fr": "fr",
"gb": "gb",
"gg": "gg",
"gi": "gi",
"gr": "gr",
"hr": "hr",
"hu": "hu",
"ie": "ie",
"im": "im",
"is": "is",
"it": "it",
"je": "je",
"li": "li",
"lt": "lt",
"lu": "lu",
"lv": "lv",
"mc": "mc",
"md": "md",
"me": "me",
"mk": "mk",
"mt": "mt",
"nl": "nl",
"no": "no",
"pl": "pl",
"pt": "pt",
"ro": "ro",
"rs": "rs",
"se": "se",
"si": "si",
"sk": "sk",
"sm": "sm",
"ua": "ua",
"uk": "uk",
"va": "va",
" ": " ",
"a": "ba",
"c": "de",
"f": "fr",
"g": "de",
"h": "hr",
"i": "fi",
"j": "je",
"k": "dk",
"l": "nl",
"m": "com",
"n": "nl",
"o": "com",
"p": "pl",
"q": "eu",
"r": "fr",
"s": "es",
"t": "net",
"u": "eu",
"v": "lv",
"w": "de",
"x": "ax",
"y": "by",
"z": "cz",
}
Maps 4 Top Level Domain
View Source
var TLD2WordsMap = map[string]map[string]string{
"plus": {"t": "posteo"},
"da": {"a": "de"},
"a": {"d": "ad", "l": "al", "t": "at", "x": "ax"},
"b": {"a": "ba", "e": "be", "g": "bg", "y": "by"},
"c": {"h": "ch", "y": "cy", "z": "cz"},
"d": {"e": "de", "k": "dk"},
"e": {"u": "eu", "e": "ee", "s": "es"},
"f": {"i": "fi", "o": "fo", "r": "fr"},
"g": {"b": "gb", "g": "gg", "i": "gi", "r": "gr"},
"h": {"r": "hr", "u": "hu"},
"i": {"e": "ie", "m": "im", "s": "is", "t": "it"},
"j": {"e": "je"},
"l": {"i": "li", "t": "lt", "u": "lu", "v": "lv"},
"m": {"c": "mc", "d": "md", "e": "me", "k": "mk", "t": "mt"},
"n": {"l": "nl", "o": "no"},
"p": {"l": "pl", "t": "pt"},
"r": {"o": "ro", "s": "rs"},
"s": {"e": "se", "i": "si", "k": "sk", "m": "sm"},
"t": {"r": "tr"},
"u": {"a": "ua", "k": "uk"},
"v": {"a": "va"},
}
View Source
var TLD3WordsMap = map[string]map[string]map[string]string{}
Functions ¶
func CHRsolver ¶
Try all rules in 'CHRruleStore' with CHR-goals in CHR-store until no rule fired. CHRsolver used the trace- or no-trace function
func CheckSpellAndText ¶
func CheckSpellAndText(spell Term, text Term) bool
func ClearCHRStore ¶
func ClearCHRStore(rs *RuleStore)
func Email2text ¶
func EqualVarName ¶
func EqualVarName(t1, t2 Term) bool
func EqualVarNameCList ¶
func EqualVarNameCList(t1 Term, t2 Term) bool
func InitSpellAndStructMap ¶
func InitSpellAndStructMap()
func ParseBIString ¶
func ParseGoalString ¶
func ParseHeadString ¶
func ParseRuleBodyString ¶
func Spell2name ¶
func Spell2name(spell Term) (Term, bool)
func Spell2namenumber ¶
func Spell2namenumber(spell Term) (Term, bool)
func Spell2text ¶
func Spell2text(spell Term) (Term, bool)
func Text2email ¶
func Text2email(text Term) (Term, Term, bool)
func Text2spell ¶
func Text2spell(text Term) (Term, bool)
func TraceRuleFired ¶
prove and trace whether rule fired
func WriteCHRStore ¶
func ZiffernZuZahl ¶
func ZiffernZuZahl(spell Term) (Term, bool)
Types ¶
type RuleStore ¶
type RuleStore struct { Result resultType CHRruleStore []*chrRule QueryVars Vars QueryStore List CHRstore store BuiltInStore store RenameRuleVars *big.Int // contains filtered or unexported fields }
func MakeRuleStore ¶
func MakeRuleStore() *RuleStore
func (*RuleStore) ParseFileCHRRulesGoals ¶
func (*RuleStore) ParseStringCHRRulesGoals ¶
parse CHR-rules and goals from string src CHR-rules:
[<rulename>] '@' <keep-heads> '==>' [<guards> '|'] <body> '.' [<rulename>] '@' <keep-heads> '/' <del-heads> '<=>' [<guards> '|'] <body>'.' [<rulename>] '@' <del-heads> '<=>' [<guards> '|'] <body>'.'
goals <predicates> '.'
Click to show internal directories.
Click to hide internal directories.