Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProfanitySentencer ¶
type ProfanitySentencer struct { profaneword.RandomDevice // contains filtered or unexported fields }
ProfanitySentencer is a type that implements Sentencer, while integrating the profanities database. ProfanitySentencer is configurable with dissallowed words.
func NewProfanitySentencer ¶
func NewProfanitySentencer(dissallowedWord Word) ProfanitySentencer
NewProfanitySentencer returns a ProfanitySentencer with the default configuration, passing a dissallowedWord to the Sentencer, and using a profaneword.CryptoRand
func (*ProfanitySentencer) GetSentence ¶
func (pw *ProfanitySentencer) GetSentence(numWords int) *Sentence
GetSentence implements SentenceFetcher for ProfanitySentencer. GetSentence builds a sentence of arbitrary length by using the internal flatSentence, recursively calling the internal map of flatSentence, and compiling a Sentence from it
func (*ProfanitySentencer) Sentence ¶ added in v0.4.1
func (pw *ProfanitySentencer) Sentence(sentence *Sentence) string
Sentence implements the Sentencer interface, using randomized text from the profanities database.
type Sentence ¶
type Sentence struct {
// contains filtered or unexported fields
}
Sentence is a linked-list of formattable structures, each with a format string, a word (type) that would fit there, and a pointer to the next part of the Sentence
type SentenceFetcher ¶
SentenceFetcher is an interface for an object that returns a Sentence of a given length.
type Word ¶
type Word uint8
Word is a bitmask for marking Word type in this library, fx, placement in a sentence
const ( // START at the start of a word START Word = 1 << iota // FILLER - just somewhere FILLER // END of the sentence END // EXCL - as an exclamation, like: "DAMN!" EXCL // SPLIT reserved for future sentence-construction (splitting using words) SPLIT // MISSPELL is inherited in the tree; covers slang and miss-spelling MISSPELL // POSITIVE is also inherited, and cover words that are not negatively laden POSITIVE // WEIRD covers very special Misspellings WEIRD // DEFAULT covers most normal-kinda words DEFAULT = START | FILLER // EXCLS just a concatenation, because they appear together often EXCLS = START | EXCL // NONE is the default: there is no word at this radixWordNode NONE Word = 0 )