transformer

package
v1.11.13 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Transform

func Transform(message string, db database.Database, skipCommon bool) string

Transform takes a message and runs each word through the thesaurus.

Types

type MessageMetadata

type MessageMetadata struct {
	Words    []string
	Metadata []*WordMetadata
	// contains filtered or unexported fields
}

MessageMetadata contains a list of words and their associated metadata.

func (*MessageMetadata) New

func (m *MessageMetadata) New(message string)

New initializes message metadata struct from a string.

func (MessageMetadata) String

func (m MessageMetadata) String() string

type ReversibleStringBuilder

type ReversibleStringBuilder struct {
	// contains filtered or unexported fields
}

ReversibleStringBuilder is a string builder that allows the user to reverse a certain number of write instructions issued to it.

func (*ReversibleStringBuilder) Flush

func (rsb *ReversibleStringBuilder) Flush() error

Flush writes everything in the buffer to the string builder. All potentially reversible operations will be saved to the string builer and can no longer be reversed.

func (*ReversibleStringBuilder) Grow

func (rsb *ReversibleStringBuilder) Grow(n int)

Grow tells the internal string builder to grow by n characters.

func (*ReversibleStringBuilder) Init

func (rsb *ReversibleStringBuilder) Init()

Init initializes internal fields within the string builder.

func (*ReversibleStringBuilder) Len

func (rsb *ReversibleStringBuilder) Len() int

Len returns the length of the string in the reversible buffer plus the length of the string in the builder.

func (*ReversibleStringBuilder) Reverse

func (rsb *ReversibleStringBuilder) Reverse(n int)

Reverse undos the last n WriteString operations. It can undo as many WriteString calls since the last call to Flush(). Passing clears the buffers.

func (*ReversibleStringBuilder) String

func (rsb *ReversibleStringBuilder) String() string

String flushes the buffer and returns the stored string.

func (*ReversibleStringBuilder) WriteString

func (rsb *ReversibleStringBuilder) WriteString(s string) (int, error)

WriteString writes to the reversible buffer without writing to the string builder. Use Flush() commit changes to the string builder.

type WordMetadata

type WordMetadata struct {
	Capitalization capitalization
	PrePunc        string
	PostPunc       string
}

WordMetadata is individual word metadata information.

Jump to

Keyboard shortcuts

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