Types
MarkovGenerator = ref object case kind*: MarkovGeneratorModelType of mgtSimple: of mgtWeighted:
- Source Edit
Procs
proc add(generator: MarkovGenerator; sample: string) {. ...raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}
- Adds string to samples. Source Edit
proc add(generator: MarkovGenerator; samples: seq[string]) {. ...raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}
- Adds seqence of strings to samples. Source Edit
proc clear(generator: MarkovGenerator) {....raises: [], tags: [], forbids: [].}
- Clears generator. Source Edit
proc generate(generator: MarkovGenerator; attempts: Positive = 1; begin = none string; validator: MarkovValidator = defaultValidator()): string {....raises: [ MarkovEmptyModelError, MarkovNotEnoughSamplesError, KeyError, Exception, MarkovOutOfAttemptsError], tags: [RootEffect], forbids: [].}
- Generates a string. Source Edit
proc model(generator: MarkovGenerator): Table[string, CountTable[string]] {. ...raises: [KeyError], tags: [], forbids: [].}
- Returns model of generator. Source Edit
proc newMarkov(samples = newSeq(); wordProc: MarkovProcessWordProc = (proc ( word: string): Option[string] = result = some unicodeStringToLower(word)); kind: MarkovGeneratorModelType = mgtSimple): MarkovGenerator {. ...raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}
- Creates an instance of Markov generator. Source Edit