gojam

package module
v0.0.0-...-14f8a85 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: MIT Imports: 5 Imported by: 2

README

gojam: Just Another Markov implementation

I'm making this for personal use for a discord bot I'm making called Polly.

Detailed instructions and docs are coming later, after I actually program it.

Documentation

Index

Constants

View Source
const (
	StartToken = "_START_"
	EndToken   = "_END_"
)

These signal the start and end of a sentence.

Variables

This section is empty.

Functions

This section is empty.

Types

type Markov

type Markov struct {
	Chain map[string]Output `json:"_chain"`
	// contains filtered or unexported fields
}

func NewMarkov

func NewMarkov(grams int, separator string) *Markov

func (Markov) FromJSON

func (m Markov) FromJSON(data []byte) error

func (Markov) GenerateExample

func (m Markov) GenerateExample() string

func (Markov) PrintMap

func (m Markov) PrintMap()

func (Markov) ToJSON

func (m Markov) ToJSON() []byte

func (Markov) TrainOnCorpus

func (m Markov) TrainOnCorpus(corpus string, endregex string)

func (Markov) TrainOnExample

func (m Markov) TrainOnExample(sentence string)

type Output

type Output struct {
	Occurrences int            `json:"o"`     //how many times the 'input' occurs. ie total of all output possibilities = 100%
	Grams       map[string]int `json:"grams"` //how many times the word appears AFTER the input
}

Jump to

Keyboard shortcuts

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