Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToMap ¶
func AddToMap(prefix, toAdd string, aMap CountedStringMap)
Add to map checks if the key/value pair exists in the map. If not, we create them, and if so, we either increment the counter on the value or initialize it if it didn't exist previously.
Types ¶
type CountedString ¶
type CountedString struct {
// contains filtered or unexported fields
}
Since both maps (the prefix -> suffix and canonical -> representation) operate about the same way, we abstract their representation into a notion of CountedStrings, where the values of the map contain both the string we care about and a count of how often it occurs.
type CountedStringList ¶
type CountedStringList struct {
// contains filtered or unexported fields
}
A CountedStringList is a list of all the CountedStrings for a given prefix, and a total number of times that prefix occurs (necessary, with the CountedString hits, for probability calculation).
func (CountedStringList) DrawProbabilistically ¶
func (cs CountedStringList) DrawProbabilistically() string
func (*CountedStringList) GetSuffix ¶
func (s *CountedStringList) GetSuffix(lookFor string) (*CountedString, bool)
For testing.
type CountedStringMap ¶
type CountedStringMap map[string]*CountedStringList
Map from a prefix in canonical form to CountedStringLists, where one will move canonical prefixes to suffixes, and another to words -> representation.
type Generator ¶
type Generator struct { PrefixLen int CharLimit int Data CountedStringMap // suffix map Reps CountedStringMap // representation map Beginnings []string // acceptable ways to start a tweet. }
Generators gives us all we need to build a fresh data model to generate from.
func CreateGenerator ¶
CreateGenerator returns a Generator that is fully initialized and ready for use.
func (*Generator) AddSeeds ¶
AddSeeds takes in a string, breaks it into prefixes, and adds it to the data model.
func (*Generator) GenerateFromPrefix ¶
We expose this version primarily for testing.
func (*Generator) GenerateText ¶
Generates text from the given generator. It stops when the character limit has run out, or it encounters a prefix it has no suffixes for.
type Opeth ¶
type Opeth struct {
// contains filtered or unexported fields
}
func NewOpethPlugin ¶
func NewOpethPlugin() *Opeth
func (*Opeth) OnMessage ¶
func (o *Opeth) OnMessage(m *dgofw.DiscordMessage)